Updated transaction::signees to mutable
and * updated get_signature_keys() to return a const reference, * get_signature_keys() will update signees on first call, * modified test cases and wallet.cpp accordingly, * no longer construct a new signed_transaction object before pushing
This commit is contained in:
parent
c110508766
commit
2dfb67e16e
12 changed files with 94 additions and 76 deletions
|
|
@ -169,9 +169,12 @@ namespace graphene { namespace app {
|
|||
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
|
||||
{
|
||||
trx.validate();
|
||||
const auto& chain_db = *_app.chain_database();
|
||||
|
||||
auto& chain_db = *_app.chain_database();
|
||||
chain_db.check_tansaction_for_duplicated_operations(trx);
|
||||
chain_db.push_transaction( signed_transaction( trx, chain_db.get_chain_id() ) );
|
||||
trx.get_signature_keys( chain_db.get_chain_id() ); // Extract public keys from signatures
|
||||
chain_db.push_transaction( trx );
|
||||
|
||||
if( _app.p2p_node() != nullptr )
|
||||
_app.p2p_node()->broadcast_transaction(trx);
|
||||
}
|
||||
|
|
@ -198,8 +201,11 @@ namespace graphene { namespace app {
|
|||
{
|
||||
trx.validate();
|
||||
_callbacks[trx.id()] = cb;
|
||||
|
||||
auto& chain_db = *_app.chain_database();
|
||||
chain_db.push_transaction( signed_transaction( trx, chain_db.get_chain_id() ) );
|
||||
trx.get_signature_keys( chain_db.get_chain_id() ); // Extract public keys from signatures
|
||||
chain_db.push_transaction( trx );
|
||||
|
||||
if( _app.p2p_node() != nullptr )
|
||||
_app.p2p_node()->broadcast_transaction(trx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,7 +506,9 @@ namespace detail {
|
|||
}
|
||||
}
|
||||
|
||||
_chain_db->push_transaction( signed_transaction( transaction_message.trx, get_chain_id() ) );
|
||||
transaction_message.trx.get_signature_keys( get_chain_id() ); // Extract public keys from signatures
|
||||
|
||||
_chain_db->push_transaction( transaction_message.trx );
|
||||
return result;
|
||||
} catch ( const graphene::chain::unlinkable_block_exception& e ) {
|
||||
// translate to a graphene::net exception
|
||||
|
|
|
|||
|
|
@ -172,16 +172,31 @@ namespace graphene { namespace chain {
|
|||
uint32_t max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH
|
||||
) const;
|
||||
|
||||
flat_set<public_key_type> get_signature_keys( const chain_id_type& chain_id )const;
|
||||
/**
|
||||
* @brief Extract public keys from signatures with given chain ID.
|
||||
* @param chain_id A chain ID
|
||||
* @return Public keys
|
||||
* @note If @ref signees is empty, E.G. when it's the first time calling
|
||||
* this function for the signed transaction, public keys will be
|
||||
* extracted with given chain ID, and be stored into the mutable
|
||||
* @ref signees field, then @ref signees will be returned;
|
||||
* otherwise, the @ref chain_id parameter will be ignored, and
|
||||
* @ref signees will be returned directly.
|
||||
*/
|
||||
const flat_set<public_key_type>& get_signature_keys( const chain_id_type& chain_id )const;
|
||||
|
||||
/** Signatures */
|
||||
vector<signature_type> signatures;
|
||||
|
||||
/** Extracted public keys from signatures if this object was initialized with a chain ID. */
|
||||
flat_set<public_key_type> signees;
|
||||
/** Public keys extracted from signatures */
|
||||
mutable flat_set<public_key_type> signees;
|
||||
|
||||
/// Removes all operations, signatures and signees
|
||||
void clear() { operations.clear(); signatures.clear(); signees.clear(); }
|
||||
|
||||
/// Removes all signatures and signees
|
||||
void clear_signatures() { signatures.clear(); signees.clear(); }
|
||||
|
||||
private:
|
||||
/// To be used by constructor and get_signature_keys() function
|
||||
flat_set<public_key_type> _get_signature_keys( const chain_id_type& chain_id )const;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ const signature_type& graphene::chain::signed_transaction::sign(const private_ke
|
|||
{
|
||||
digest_type h = sig_digest( chain_id );
|
||||
signatures.push_back(key.sign_compact(h));
|
||||
signees.clear(); // Clear signees since it may be inconsistent after added a new signature
|
||||
return signatures.back();
|
||||
}
|
||||
|
||||
|
|
@ -297,13 +298,15 @@ void verify_authority( const vector<operation>& ops, const flat_set<public_key_t
|
|||
} FC_CAPTURE_AND_RETHROW( (ops)(sigs) ) }
|
||||
|
||||
|
||||
flat_set<public_key_type> signed_transaction::get_signature_keys( const chain_id_type& chain_id )const
|
||||
const flat_set<public_key_type>& signed_transaction::get_signature_keys( const chain_id_type& chain_id )const
|
||||
{
|
||||
// Strictly we should check whether the given chain ID is same as the one used to initialize the object.
|
||||
// Strictly we should check whether the given chain ID is same as the one used to initialize the `signees` field.
|
||||
// However, we don't pass in another chain ID so far, for better performance, we skip the check.
|
||||
if( !signees.empty() || signatures.empty() )
|
||||
return signees;
|
||||
return _get_signature_keys( chain_id );
|
||||
if( signees.empty() && !signatures.empty() )
|
||||
{
|
||||
signees = _get_signature_keys( chain_id );
|
||||
}
|
||||
return signees;
|
||||
}
|
||||
|
||||
flat_set<public_key_type> signed_transaction::_get_signature_keys( const chain_id_type& chain_id )const
|
||||
|
|
@ -334,8 +337,8 @@ set<public_key_type> signed_transaction::get_required_signatures(
|
|||
vector<authority> other;
|
||||
get_required_authorities( required_active, required_owner, other );
|
||||
|
||||
|
||||
sign_state s(get_signature_keys( chain_id ),get_active,available_keys);
|
||||
const flat_set<public_key_type>& signature_keys = get_signature_keys( chain_id );
|
||||
sign_state s( signature_keys, get_active, available_keys );
|
||||
s.max_recursion = max_recursion_depth;
|
||||
|
||||
for( const auto& auth : other )
|
||||
|
|
|
|||
|
|
@ -2196,6 +2196,7 @@ public:
|
|||
owned_keys.reserve(pks.size());
|
||||
std::copy_if(pks.begin(), pks.end(), std::inserter(owned_keys, owned_keys.end()),
|
||||
[this](const public_key_type &pk) { return _keys.find(pk) != _keys.end(); });
|
||||
tx.clear_signatures();
|
||||
set<public_key_type> approving_key_set = _remote_db->get_required_signatures(tx, owned_keys);
|
||||
|
||||
auto dyn_props = get_dynamic_global_properties();
|
||||
|
|
@ -2213,8 +2214,8 @@ public:
|
|||
uint32_t expiration_time_offset = 0;
|
||||
for (;;)
|
||||
{
|
||||
tx.set_expiration(dyn_props.time + fc::seconds(30 + expiration_time_offset));
|
||||
tx.signatures.clear();
|
||||
tx.set_expiration( dyn_props.time + fc::seconds(30 + expiration_time_offset) );
|
||||
tx.clear_signatures();
|
||||
|
||||
for (const public_key_type &key : approving_key_set)
|
||||
tx.sign(get_private_key(key), _chain_id);
|
||||
|
|
@ -2295,7 +2296,6 @@ public:
|
|||
trx.operations = {op};
|
||||
set_operation_fees( trx, _remote_db->get_global_properties().parameters.current_fees);
|
||||
trx.validate();
|
||||
idump((broadcast));
|
||||
|
||||
return sign_transaction(trx, broadcast);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -699,7 +699,6 @@ const account_object& database_fixture::create_account(
|
|||
trx.validate();
|
||||
|
||||
processed_transaction ptx = db.push_transaction(trx, ~0);
|
||||
//wdump( (ptx) );
|
||||
const account_object& result = db.get<account_object>(ptx.operation_results[0].get<object_id_type>());
|
||||
trx.operations.clear();
|
||||
return result;
|
||||
|
|
@ -769,7 +768,6 @@ const limit_order_object*database_fixture::create_sell_order(account_id_type use
|
|||
|
||||
const limit_order_object* database_fixture::create_sell_order( const account_object& user, const asset& amount, const asset& recv )
|
||||
{
|
||||
//wdump((amount)(recv));
|
||||
limit_order_create_operation buy_order;
|
||||
buy_order.seller = user.id;
|
||||
buy_order.amount_to_sell = amount;
|
||||
|
|
@ -780,7 +778,6 @@ const limit_order_object* database_fixture::create_sell_order( const account_obj
|
|||
auto processed = db.push_transaction(trx, ~0);
|
||||
trx.operations.clear();
|
||||
verify_asset_supplies(db);
|
||||
//wdump((processed));
|
||||
return db.find<limit_order_object>( processed.operation_results[0].get<object_id_type>() );
|
||||
}
|
||||
|
||||
|
|
@ -1564,7 +1561,8 @@ bool _push_block( database& db, const signed_block& b, uint32_t skip_flags /* =
|
|||
|
||||
processed_transaction _push_transaction( database& db, const signed_transaction& tx, uint32_t skip_flags /* = 0 */ )
|
||||
{ try {
|
||||
auto pt = db.push_transaction( signed_transaction( tx, db.get_chain_id() ), skip_flags );
|
||||
tx.get_signature_keys( db.get_chain_id() ); // Extract public keys from signatures
|
||||
auto pt = db.push_transaction( tx, skip_flags );
|
||||
database_fixture::verify_asset_supplies(db);
|
||||
return pt;
|
||||
} FC_CAPTURE_AND_RETHROW((tx)) }
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ BOOST_AUTO_TEST_CASE( any_two_of_three )
|
|||
trx.operations.push_back(op);
|
||||
sign(trx, nathan_key1);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
} FC_CAPTURE_AND_RETHROW ((nathan.active))
|
||||
|
||||
transfer_operation op;
|
||||
|
|
@ -99,19 +98,19 @@ BOOST_AUTO_TEST_CASE( any_two_of_three )
|
|||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, core), static_cast<int64_t>(old_balance - 500));
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign(trx, nathan_key2);
|
||||
sign(trx, nathan_key3);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, core), static_cast<int64_t>(old_balance - 1000));
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign(trx, nathan_key1);
|
||||
sign(trx, nathan_key3);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, core), static_cast<int64_t>(old_balance - 1500));
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
//sign(trx, fc::ecc::private_key::generate());
|
||||
sign(trx,nathan_key3);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
|
|
@ -156,7 +155,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
BOOST_TEST_MESSAGE( "Attempting to transfer with parent1 signature, should fail" );
|
||||
sign(trx,parent1_key);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting to transfer with parent2 signature, should fail" );
|
||||
sign(trx,parent2_key);
|
||||
|
|
@ -166,8 +165,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
sign(trx,parent1_key);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(child, core), static_cast<int64_t>(old_balance - 500));
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Adding a key for the child that can override parents" );
|
||||
fc::ecc::private_key child_key = fc::ecc::private_key::generate();
|
||||
|
|
@ -181,8 +179,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
sign(trx,parent2_key);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_REQUIRE_EQUAL(child.active.num_auths(), 3u);
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
}
|
||||
|
||||
op.from = child.id;
|
||||
|
|
@ -195,7 +192,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
BOOST_TEST_MESSAGE( "Attempting transfer just parent1, should fail" );
|
||||
sign(trx, parent1_key);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer just parent2, should fail" );
|
||||
sign(trx, parent2_key);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
|
|
@ -204,14 +201,13 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
sign(trx, parent1_key);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(child, core), static_cast<int64_t>(old_balance - 1000));
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer with just child key, should succeed" );
|
||||
sign(trx, child_key);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(child, core), static_cast<int64_t>(old_balance - 1500));
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Creating grandparent account, parent1 now requires authority of grandparent" );
|
||||
auto grandparent = create_account("grandparent");
|
||||
|
|
@ -227,8 +223,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
op.owner = *op.active;
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempt to transfer using old parent keys, should fail" );
|
||||
|
|
@ -236,7 +231,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
sign(trx, parent1_key);
|
||||
sign(trx, parent2_key);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, parent2_key );
|
||||
sign( trx, grandparent_key );
|
||||
|
||||
|
|
@ -253,8 +248,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
op.owner = *op.active;
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE( "Create recursion depth failure" );
|
||||
|
|
@ -265,12 +259,11 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
//Fails due to recursion depth.
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "verify child key can override recursion checks" );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign(trx, child_key);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(child, core), static_cast<int64_t>(old_balance - 2500));
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify a cycle fails" );
|
||||
{
|
||||
|
|
@ -280,8 +273,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
op.owner = *op.active;
|
||||
trx.operations.push_back(op);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
}
|
||||
|
||||
trx.operations.push_back(op);
|
||||
|
|
@ -372,7 +364,7 @@ BOOST_AUTO_TEST_CASE( proposed_single_account )
|
|||
//committee has no stake in the transaction.
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
pup.active_approvals_to_add.clear();
|
||||
pup.active_approvals_to_add.insert(nathan.id);
|
||||
|
||||
|
|
@ -408,7 +400,7 @@ BOOST_AUTO_TEST_CASE( proposal_failure )
|
|||
pop.expiration_time = db.head_block_time() + fc::days(1);
|
||||
pop.fee_paying_account = bob_id;
|
||||
trx.operations.push_back( pop );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, bob_private_key );
|
||||
processed_transaction processed = PUSH_TX( db, trx );
|
||||
proposal_object prop = db.get<proposal_object>(processed.operation_results.front().get<object_id_type>());
|
||||
|
|
@ -456,7 +448,7 @@ BOOST_AUTO_TEST_CASE( committee_authority )
|
|||
sign(trx, committee_key);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), graphene::chain::invalid_committee_approval );
|
||||
|
||||
auto _sign = [&] { trx.signatures.clear(); sign( trx, nathan_key ); };
|
||||
auto _sign = [&] { trx.clear_signatures(); sign( trx, nathan_key ); };
|
||||
|
||||
proposal_create_operation pop;
|
||||
pop.proposed_ops.push_back({trx.operations.front()});
|
||||
|
|
@ -490,8 +482,7 @@ BOOST_AUTO_TEST_CASE( committee_authority )
|
|||
|
||||
BOOST_TEST_MESSAGE( "Checking that the proposal is not authorized to execute" );
|
||||
BOOST_REQUIRE(!db.get<proposal_object>(prop.id).is_authorized_to_execute(db));
|
||||
trx.operations.clear();
|
||||
trx.signatures.clear();
|
||||
trx.clear();
|
||||
proposal_update_operation uop;
|
||||
uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
|
||||
uop.proposal = prop.id;
|
||||
|
|
@ -512,7 +503,7 @@ BOOST_AUTO_TEST_CASE( committee_authority )
|
|||
// fails
|
||||
// BOOST_CHECK(db.get<proposal_object>(prop.id).is_authorized_to_execute(db));
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
generate_blocks(*prop.review_period_time);
|
||||
uop.key_approvals_to_add.clear();
|
||||
uop.key_approvals_to_add.insert(committee_key.get_public_key()); // was 7
|
||||
|
|
@ -1069,16 +1060,17 @@ BOOST_FIXTURE_TEST_CASE( bogus_signature, database_fixture )
|
|||
PUSH_TX( db, trx, skip );
|
||||
|
||||
trx.operations.push_back( xfer_op );
|
||||
trx.signees.clear(); // signees should be invalidated
|
||||
BOOST_TEST_MESSAGE( "Invalidating Alices Signature" );
|
||||
// Alice's signature is now invalid
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, skip ), fc::exception );
|
||||
// Re-sign, now OK (sig is replaced)
|
||||
BOOST_TEST_MESSAGE( "Resign with Alice's Signature" );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, alice_key );
|
||||
PUSH_TX( db, trx, skip );
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
trx.operations.pop_back();
|
||||
sign( trx, alice_key );
|
||||
sign( trx, charlie_key );
|
||||
|
|
@ -1127,7 +1119,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture )
|
|||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
op.new_options->num_committee = 3;
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, vikram_private_key );
|
||||
PUSH_TX( db, trx );
|
||||
trx.clear();
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ BOOST_AUTO_TEST_CASE( tapos )
|
|||
//relative_expiration is 1, but ref block is 2 blocks old, so this should fail.
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db1, trx, database::skip_transaction_signatures | database::skip_authority_check ), fc::exception);
|
||||
set_expiration( db1, trx );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
trx.sign( init_account_priv_key, db1.get_chain_id() );
|
||||
db1.push_transaction(trx, database::skip_transaction_signatures | database::skip_authority_check);
|
||||
} catch (fc::exception& e) {
|
||||
|
|
@ -682,14 +682,14 @@ BOOST_FIXTURE_TEST_CASE( optional_tapos, database_fixture )
|
|||
|
||||
tx.ref_block_num = 0;
|
||||
tx.ref_block_prefix = 0;
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
PUSH_TX( db, tx );
|
||||
|
||||
BOOST_TEST_MESSAGE( "proper ref_block_num, ref_block_prefix" );
|
||||
|
||||
set_expiration( db, tx );
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
PUSH_TX( db, tx );
|
||||
|
||||
|
|
@ -697,7 +697,7 @@ BOOST_FIXTURE_TEST_CASE( optional_tapos, database_fixture )
|
|||
|
||||
tx.ref_block_num = 0;
|
||||
tx.ref_block_prefix = 0x12345678;
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, tx ), fc::exception );
|
||||
|
||||
|
|
@ -705,7 +705,7 @@ BOOST_FIXTURE_TEST_CASE( optional_tapos, database_fixture )
|
|||
|
||||
tx.ref_block_num = 1;
|
||||
tx.ref_block_prefix = 0x12345678;
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, tx ), fc::exception );
|
||||
|
||||
|
|
@ -713,7 +713,7 @@ BOOST_FIXTURE_TEST_CASE( optional_tapos, database_fixture )
|
|||
|
||||
tx.ref_block_num = 9999;
|
||||
tx.ref_block_prefix = 0x12345678;
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, tx ), fc::exception );
|
||||
}
|
||||
|
|
@ -858,8 +858,8 @@ BOOST_FIXTURE_TEST_CASE( double_sign_check, database_fixture )
|
|||
|
||||
BOOST_TEST_MESSAGE( "Verify that signing once with the proper key passes" );
|
||||
trx.signatures.pop_back();
|
||||
trx.signees.clear(); // signees should be invalidated
|
||||
db.push_transaction(trx, 0);
|
||||
sign( trx, bob_private_key );
|
||||
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
|
|
@ -1218,7 +1218,7 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
|
|||
|
||||
signed_transaction tx = generate_xfer_tx( alice_id, bob_id, 1000, 2 );
|
||||
tx.set_expiration( db.head_block_time() + 2 * db.get_global_properties().parameters.block_interval );
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
sign( tx, alice_private_key );
|
||||
// put the tx in db tx cache
|
||||
PUSH_TX( db, tx );
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( confidential_test )
|
|||
trx.operations = {to_blind};
|
||||
sign( trx, dan_private_key );
|
||||
db.push_transaction(trx);
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Transfering from blind to blind with change address" );
|
||||
auto Out3B = fc::sha256::hash("Out3B");
|
||||
|
|
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE( confidential_test )
|
|||
from_blind.blinding_factor = Out4B;
|
||||
from_blind.inputs.push_back( {out4.commitment, out4.owner} );
|
||||
trx.operations = {from_blind};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
db.push_transaction(trx);
|
||||
|
||||
BOOST_REQUIRE_EQUAL( get_balance( nathan, core ), 750-300-10-10 );
|
||||
|
|
|
|||
|
|
@ -398,6 +398,8 @@ BOOST_AUTO_TEST_CASE( check_passes_for_duplicated_betting_market_or_group )
|
|||
|
||||
proposal_create_operation pcop2 = pcop1;
|
||||
|
||||
trx.clear();
|
||||
|
||||
pcop1.proposed_ops.emplace_back( evcop1 );
|
||||
pcop1.proposed_ops.emplace_back( bmgcop );
|
||||
pcop1.proposed_ops.emplace_back( bmcop );
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ BOOST_AUTO_TEST_CASE( worker_pay_test )
|
|||
trx.operations.push_back(op);
|
||||
sign( trx, nathan_private_key );
|
||||
PUSH_TX( db, trx );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
REQUIRE_THROW_WITH_VALUE(op, amount, asset(1));
|
||||
trx.clear();
|
||||
}
|
||||
|
|
@ -710,7 +710,7 @@ BOOST_AUTO_TEST_CASE( worker_pay_test )
|
|||
trx.operations.back() = op;
|
||||
sign( trx, nathan_private_key );
|
||||
PUSH_TX( db, trx );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
trx.clear();
|
||||
}
|
||||
|
||||
|
|
@ -1164,7 +1164,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
op.total_claimed.amount = 151;
|
||||
op.balance_owner_key = v2_key.get_public_key();
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v2_key );
|
||||
// Attempting to claim 151 from a balance with 150 available
|
||||
|
|
@ -1174,7 +1174,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
op.total_claimed.amount = 100;
|
||||
op.balance_owner_key = v2_key.get_public_key();
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v2_key );
|
||||
db.push_transaction(trx);
|
||||
|
|
@ -1183,7 +1183,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
|
||||
op.total_claimed.amount = 10;
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v2_key );
|
||||
// Attempting to claim twice within a day
|
||||
|
|
@ -1198,7 +1198,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
op.total_claimed.amount = 500;
|
||||
op.balance_owner_key = v1_key.get_public_key();
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v1_key );
|
||||
db.push_transaction(trx);
|
||||
|
|
@ -1209,7 +1209,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
op.balance_owner_key = v2_key.get_public_key();
|
||||
op.total_claimed.amount = 10;
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v2_key );
|
||||
// Attempting to claim twice within a day
|
||||
|
|
@ -1222,7 +1222,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
|
||||
op.total_claimed = vesting_balance_2.balance;
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
_sign( trx, n_key );
|
||||
_sign( trx, v2_key );
|
||||
db.push_transaction(trx);
|
||||
|
|
@ -1650,7 +1650,7 @@ BOOST_AUTO_TEST_CASE( buyback )
|
|||
// Alice and Philbin signed, but asset issuer is invalid
|
||||
GRAPHENE_CHECK_THROW( db.push_transaction(tx), account_create_buyback_incorrect_issuer );
|
||||
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
tx.operations.back().get< account_create_operation >().extensions.value.buyback_options->asset_to_buy_issuer = izzy_id;
|
||||
sign( tx, philbin_private_key );
|
||||
|
||||
|
|
@ -1663,7 +1663,7 @@ BOOST_AUTO_TEST_CASE( buyback )
|
|||
rex_id = ptx.operation_results.back().get< object_id_type >();
|
||||
|
||||
// Try to create another account rex2 which is bbo on same asset
|
||||
tx.signatures.clear();
|
||||
tx.clear_signatures();
|
||||
tx.operations.back().get< account_create_operation >().name = "rex2";
|
||||
sign( tx, izzy_private_key );
|
||||
sign( tx, philbin_private_key );
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE( override_transfer_test )
|
|||
sign( trx, dan_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), tx_missing_active_auth );
|
||||
BOOST_TEST_MESSAGE( "Pass with issuer's signature" );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, sam_private_key );
|
||||
PUSH_TX( db, trx, 0 );
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE( override_transfer_test2 )
|
|||
sign( trx, dan_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Fail because overide_authority flag is not set" );
|
||||
trx.signatures.clear();
|
||||
trx.clear_signatures();
|
||||
sign( trx, sam_private_key );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue