Skip to content

Commit b5c73b3

Browse files
committed
add test for cooldown period
1 parent c21c1d6 commit b5c73b3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pallets/subtensor/src/tests/children.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3949,3 +3949,29 @@ fn test_dividend_distribution_with_children_same_coldkey_owner() {
39493949
);
39503950
});
39513951
}
3952+
3953+
#[test]
3954+
fn test_pending_cooldown_one_day() {
3955+
let curr_block = 1;
3956+
new_test_ext(curr_block).execute_with(|| {
3957+
let coldkey = U256::from(1);
3958+
let hotkey = U256::from(2);
3959+
let child1 = U256::from(3);
3960+
let child2 = U256::from(4);
3961+
let netuid: u16 = 1;
3962+
let proportion1: u64 = 1000;
3963+
let proportion2: u64 = 2000;
3964+
3965+
// Add network and register hotkey
3966+
add_network(netuid, 13, 0);
3967+
register_ok_neuron(netuid, hotkey, coldkey, 0);
3968+
3969+
// Set multiple children
3970+
mock_schedule_children(&coldkey, &hotkey, netuid, &[(proportion1, child1), (proportion2, child2)]);
3971+
3972+
// Verify pending map
3973+
let pending_children = PendingChildKeys::<Test>::get(netuid, hotkey);
3974+
assert_eq!(pending_children.0, vec![(proportion1, child1), (proportion2, child2)]);
3975+
assert_eq!(pending_children.1, curr_block + 7_200);
3976+
});
3977+
}

0 commit comments

Comments
 (0)