nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 783 forks source link

debug_assert in work_generate_blocking using qt wallet #3017

Open wezrule opened 3 years ago

wezrule commented 3 years ago

Reported by @cryptocode

boost::optional<uint64_t> nano::node::work_generate_blocking (nano::block & block_a)
{
    debug_assert (network_params.network.is_dev_network ());
    return work_generate_blocking (block_a, default_difficulty (nano::work_version::work_1));
}

This assert hits when creating a block in the qt wallet. This variant of work_generate_blocking is only meant for tests. Spoke with @guilhermelawless who said it looks like it was missed in https://github.com/nanocurrency/nano-node/pull/2569 and it should call the same overload (taking difficulty) as the non-qt wallet.

guilhermelawless commented 3 years ago

@wezrule @zhyatt I should be able to give this a go. The node wallet behavior is to grab cached work and, if the difficulty isn't high enough, obtain it again.

It looks like the QT wallet doesn't grab any cached work, could you confirm this and let me know if that would be the desired behavior instead? If so, it seems reasonable to extract the node wallet behavior and use that from the QT wallet as well.

^ nevermind, this is only an issue in block creation

zhyatt commented 3 years ago

Thanks @guilhermelawless - assigned to you. Let us know if you need anything from our end.