We found three issues with remote staking when testing on the testnet.
Transaction picking might fail because of invalid coinbase transaction which sends remote-staking coins to non-remote staking script. That happened because transaction picking was via invoking BlockAssembler::CreateNewBlock. BlockAssembler::CreateNewBlock generates a coinbase transaction which sends the stake to the provided script and when it picks a remote-staking output it results in invalid coinbase transaction.
A node can generate invalid coinbase transaction which tries to combine remote-staking and non-remote-staking outputs and send them to a non-remote-staking script.
A node which has its own funds and remote staking funds can send its funds to remote staking script because of stake combining.
The first bug is fixed by introducing BlockAssembler::PickTransactions which only picks transactions and does not do an unnecessary job.
The second and the third bugs are fixed by disabling stake combination in BlockBuilder when staking a remote-staking coin and by skipping remote-staking coins in stake combination.
We found three issues with remote staking when testing on the testnet.
BlockAssembler::CreateNewBlock
.BlockAssembler::CreateNewBlock
generates a coinbase transaction which sends the stake to the provided script and when it picks a remote-staking output it results in invalid coinbase transaction.The first bug is fixed by introducing
BlockAssembler::PickTransactions
which only picks transactions and does not do an unnecessary job.The second and the third bugs are fixed by disabling stake combination in
BlockBuilder
when staking a remote-staking coin and by skipping remote-staking coins in stake combination.