From 19b1ec46886cf85be7f3d278d0e3a1ebb0272542 Mon Sep 17 00:00:00 2001 From: coolu <13291859621@163.com> Date: Mon, 19 Nov 2018 15:44:57 +0800 Subject: [PATCH] Change Address to keys::Address, change TxSet interface (#109) --- cxrml/bridge/btc/src/lib.rs | 6 +++--- cxrml/bridge/btc/src/tx/mod.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cxrml/bridge/btc/src/lib.rs b/cxrml/bridge/btc/src/lib.rs index e9c7ba00d48c5..f6155d6f8d04c 100644 --- a/cxrml/bridge/btc/src/lib.rs +++ b/cxrml/bridge/btc/src/lib.rs @@ -212,7 +212,7 @@ decl_storage! { // ===== // tx - pub ReceiveAddress get(receive_address) config(): Option
; + pub ReceiveAddress get(receive_address) config(): Option; pub RedeemScript get(redeem_script) config(): Option>; pub CertAddress get(cert_address) config(): Option; pub CertRedeemScript get(cert_redeem_script) config(): Option>; @@ -221,10 +221,10 @@ decl_storage! { pub UTXOMaxIndex get(utxo_max_index) config(): u64; pub IrrBlock get(irr_block) config(): u32; pub BtcFee get(btc_fee) config(): u64; - pub TxSet get(tx_set): map H256 => Option<(T::AccountId, keys::Address, TxType, u64, BTCTransaction, H256)>; // Address, type, balance + pub TxSet get(tx_set): map H256 => Option<(T::AccountId, keys::Address, TxType, u64, H256, BTCTransaction)>; // Address, type, balance pub BlockTxids get(block_txids): map H256 => Vec; pub AddressMap get(address_map): map Address => Option; - pub AccountMap get(account_map): map T::AccountId => Option
; + pub AccountMap get(account_map): map T::AccountId => Option; pub TxProposal get(tx_proposal): Option>; pub DepositCache get(deposit_cache): Option>; // account_id, amount, H256 diff --git a/cxrml/bridge/btc/src/tx/mod.rs b/cxrml/bridge/btc/src/tx/mod.rs index e756d881bb38e..49998e9317d19 100644 --- a/cxrml/bridge/btc/src/tx/mod.rs +++ b/cxrml/bridge/btc/src/tx/mod.rs @@ -149,12 +149,12 @@ impl TxStorage { // todo 检查block是否存在 >::mutate(block_hash.clone(), |v| v.push(hash.clone())); - >::insert(hash, (who.clone(), address, tx_type, balance, tx, block_hash)); + >::insert(hash, (who.clone(), address, tx_type, balance, block_hash, tx)); } fn find_tx(txid: &H256) -> Option { if let Some(tuple) = >::get(txid) { - return Some(tuple.4); + return Some(tuple.5); } else { return None; } @@ -171,7 +171,7 @@ impl RollBack for TxStorage { let txids = >::get(header); for txid in txids.iter() { - let (_, _, tx_type, _, tx, _,) = >::get(txid).unwrap(); + let (_, _, tx_type, _, _, tx) = >::get(txid).unwrap(); match tx_type { TxType::Withdraw => { let out_point_set = tx