send signatures for bitcoin transaction
This commit is contained in:
parent
2f03465991
commit
610426836b
1 changed files with 37 additions and 0 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/protocol/transfer.hpp>
|
||||
#include <graphene/chain/sidechain_address_object.hpp>
|
||||
#include <graphene/chain/sidechain_transaction_object.hpp>
|
||||
#include <graphene/chain/son_wallet_object.hpp>
|
||||
#include <graphene/chain/son_wallet_withdraw_object.hpp>
|
||||
#include <graphene/peerplays_sidechain/sidechain_net_manager.hpp>
|
||||
|
|
@ -517,6 +518,42 @@ void peerplays_sidechain_plugin_impl::create_son_deregister_proposals() {
|
|||
});
|
||||
fut.wait(fc::seconds(10));
|
||||
}
|
||||
|
||||
if(proposal->proposed_transaction.operations.size() == 1
|
||||
&& proposal->proposed_transaction.operations[0].which() == chain::operation::tag<chain::bitcoin_transaction_send_operation>::value) {
|
||||
approve_proposal( son_id, proposal->id );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( object_id.is<chain::bitcoin_transaction_object>() ) {
|
||||
const object* obj = plugin.database().find_object(object_id);
|
||||
const chain::bitcoin_transaction_object* tx_object = dynamic_cast<const chain::bitcoin_transaction_object*>(obj);
|
||||
|
||||
for (son_id_type son_id : _sons) {
|
||||
auto it = tx_object->signatures.find(son_id);
|
||||
if (it == tx_object->signatures.end())
|
||||
continue;
|
||||
if (it->second.empty())
|
||||
{
|
||||
bitcoin_transaction_sign_operation op;
|
||||
son_object s_obj= get_son_object(son_id);
|
||||
op.payer = s_obj.son_account;
|
||||
// op.tx_id = object_id;
|
||||
fc::ecc::private_key k = get_private_key(son_id);
|
||||
//op.signatures = signatures_for_raw_transaction(unsigned_tx, amounts, redeem_script, k);
|
||||
|
||||
signed_transaction trx = database().create_signed_transaction(get_private_key(plugin.get_current_son_id()), op);
|
||||
try {
|
||||
database().push_transaction(trx, database::validation_steps::skip_block_size_check);
|
||||
if(plugin.app().p2p_node())
|
||||
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
||||
} catch(fc::exception e){
|
||||
ilog("sidechain_net_handler: sending proposal for son wallet update operation failed with exception ${e}",("e", e.what()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue