State blocks output for QT wallet "Create Block" (#934)

* State blocks output for QT wallet "Create Block"

* Clang formatting
This commit is contained in:
SergiySW 2018-06-30 02:21:42 +03:00 committed by Russel Waters
commit 70df6feb84

View file

@ -2108,7 +2108,9 @@ void rai_qt::block_creation::create_send ()
rai::account_info info;
auto error (wallet.node.store.account_get (transaction, account_l, info));
assert (!error);
rai::send_block send (info.head, destination_l, balance - amount_l.number (), key, account_l, 0);
auto rep_block (wallet.node.store.block_get (transaction, info.rep_block));
assert (rep_block != nullptr);
rai::state_block send (account_l, info.head, rep_block->representative (), balance - amount_l.number (), destination_l, key, account_l, 0);
wallet.node.work_generate_blocking (send);
std::string block_l;
send.serialize_json (block_l);
@ -2172,7 +2174,9 @@ void rai_qt::block_creation::create_receive ()
auto error (wallet.wallet_m->store.fetch (transaction, pending_key.account, key));
if (!error)
{
rai::receive_block receive (info.head, source_l, key, pending_key.account, 0);
auto rep_block (wallet.node.store.block_get (transaction, info.rep_block));
assert (rep_block != nullptr);
rai::state_block receive (pending_key.account, info.head, rep_block->representative (), info.balance.number () + pending.amount.number (), source_l, key, pending_key.account, 0);
wallet.node.work_generate_blocking (receive);
std::string block_l;
receive.serialize_json (block_l);
@ -2236,7 +2240,7 @@ void rai_qt::block_creation::create_change ()
auto error (wallet.wallet_m->store.fetch (transaction, account_l, key));
if (!error)
{
rai::change_block change (info.head, representative_l, key, account_l, 0);
rai::state_block change (account_l, info.head, representative_l, info.balance, 0, key, account_l, 0);
wallet.node.work_generate_blocking (change);
std::string block_l;
change.serialize_json (block_l);
@ -2298,7 +2302,7 @@ void rai_qt::block_creation::create_open ()
auto error (wallet.wallet_m->store.fetch (transaction, pending_key.account, key));
if (!error)
{
rai::open_block open (source_l, representative_l, pending_key.account, key, pending_key.account, 0);
rai::state_block open (pending_key.account, 0, representative_l, pending.amount, source_l, key, pending_key.account, 0);
wallet.node.work_generate_blocking (open);
std::string block_l;
open.serialize_json (block_l);