Fix: do_evaluate method incorrect witness

This commit is contained in:
Anton Boltach 2019-03-20 10:21:35 +03:00 committed by Anzhy Cherrnyavski
parent 22826fd680
commit 4a20369013
3 changed files with 7 additions and 2 deletions

View file

@ -116,8 +116,7 @@ void_result bitcoin_transaction_sign_evaluator::do_evaluate( const bitcoin_trans
const auto& proposal_itr = proposal_idx.find( op.proposal_id );
FC_ASSERT( proposal_idx.end() != proposal_itr, "proposal not found");
witness_id_type scheduled_witness = d.get_scheduled_witness( 1 );
const auto& witness_obj = d.get< witness_object >( scheduled_witness );
const auto& witness_obj = d.get< witness_object >( d._current_witness_id );
FC_ASSERT( witness_obj.witness_account == op.payer, "Incorrect witness." );
sidechain::bytes public_key( public_key_data_to_bytes( witness_obj.signing_key.key_data ) );

View file

@ -436,6 +436,8 @@ signed_block database::_generate_block(
send_btc_tx_flag = false;
_current_witness_id = witness_obj.id;
uint64_t postponed_tx_count = 0;
// pop pending state (reset to head block state)
for( const processed_transaction& tx : _pending_tx )
@ -587,6 +589,8 @@ void database::apply_block( const signed_block& next_block, uint32_t skip )
skip = ~0;// WE CAN SKIP ALMOST EVERYTHING
}
_current_witness_id = next_block.witness;
detail::with_skip_flags( *this, skip, [&]()
{
_apply_block( next_block );

View file

@ -570,6 +570,8 @@ namespace graphene { namespace chain {
bool send_btc_tx_flag = true;
witness_id_type _current_witness_id;
private:
void restore_bitcoin_transaction_status(); // db_sidechain