Skip to content

Commit

Permalink
Change Address to keys::Address, change TxSet interface (paritytech#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
eee-byte authored and toxotguo committed Nov 19, 2018
1 parent 14dfb24 commit 19b1ec4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cxrml/bridge/btc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ decl_storage! {

// =====
// tx
pub ReceiveAddress get(receive_address) config(): Option<Address>;
pub ReceiveAddress get(receive_address) config(): Option<keys::Address>;
pub RedeemScript get(redeem_script) config(): Option<Vec<u8>>;
pub CertAddress get(cert_address) config(): Option<keys::Address>;
pub CertRedeemScript get(cert_redeem_script) config(): Option<Vec<u8>>;
Expand All @@ -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<H256>;
pub AddressMap get(address_map): map Address => Option<T::AccountId>;
pub AccountMap get(account_map): map T::AccountId => Option<Address>;
pub AccountMap get(account_map): map T::AccountId => Option<keys::Address>;
pub TxProposal get(tx_proposal): Option<CandidateTx<T::AccountId>>;
pub DepositCache get(deposit_cache): Option<Vec<(T::AccountId, u64, H256)>>; // account_id, amount, H256

Expand Down
6 changes: 3 additions & 3 deletions cxrml/bridge/btc/src/tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ impl<T: Trait> TxStorage<T> {
// todo 检查block是否存在
<BlockTxids<T>>::mutate(block_hash.clone(), |v| v.push(hash.clone()));

<TxSet<T>>::insert(hash, (who.clone(), address, tx_type, balance, tx, block_hash));
<TxSet<T>>::insert(hash, (who.clone(), address, tx_type, balance, block_hash, tx));
}

fn find_tx(txid: &H256) -> Option<Transaction> {
if let Some(tuple) = <TxSet<T>>::get(txid) {
return Some(tuple.4);
return Some(tuple.5);
} else {
return None;
}
Expand All @@ -171,7 +171,7 @@ impl<T: Trait> RollBack<T> for TxStorage<T> {

let txids = <BlockTxids<T>>::get(header);
for txid in txids.iter() {
let (_, _, tx_type, _, tx, _,) = <TxSet<T>>::get(txid).unwrap();
let (_, _, tx_type, _, _, tx) = <TxSet<T>>::get(txid).unwrap();
match tx_type {
TxType::Withdraw => {
let out_point_set = tx
Expand Down

0 comments on commit 19b1ec4

Please sign in to comment.