File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1051,7 +1051,7 @@ impl TransactionExt for Transaction {
1051
1051
/// Get the amount of btc that self sent to `dest`, if any
1052
1052
fn get_payment_amount_to ( & self , dest : Payload ) -> Option < u64 > {
1053
1053
self . output . iter ( ) . find_map ( |uxto| {
1054
- let payload = Payload :: from_script ( & uxto. script_pubkey ) ?;
1054
+ let payload = Payload :: from_script ( & uxto. script_pubkey ) . ok ( ) ?;
1055
1055
if payload == dest {
1056
1056
Some ( uxto. value )
1057
1057
} else {
@@ -1075,7 +1075,7 @@ impl TransactionExt for Transaction {
1075
1075
. iter ( )
1076
1076
. enumerate ( )
1077
1077
. filter ( |( _, x) | x. value > 0 )
1078
- . filter_map ( |( idx, tx_out) | Some ( ( idx, Payload :: from_script ( & tx_out. script_pubkey ) ?) ) )
1078
+ . filter_map ( |( idx, tx_out) | Some ( ( idx, Payload :: from_script ( & tx_out. script_pubkey ) . ok ( ) ?) ) )
1079
1079
. collect ( )
1080
1080
}
1081
1081
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ impl Wallet {
212
212
}
213
213
214
214
pub fn get_priv_key ( & self , script_pubkey : & Script ) -> Result < PrivateKey , Error > {
215
- let address = Address :: from_script ( script_pubkey, self . network ) . ok_or ( Error :: InvalidAddress ) ?;
215
+ let address = Address :: from_script ( script_pubkey, self . network ) ?;
216
216
let key_store = self . key_store . read ( ) ?;
217
217
let private_key = key_store. get ( & address) . ok_or ( Error :: NoPrivateKey ) ?;
218
218
Ok ( * private_key)
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl PartialAddress for BtcAddress {
49
49
Self :: P2WSHv0 ( hash) => Script :: new_v0_wsh ( & WScriptHash :: from_slice ( hash. as_bytes ( ) ) ?) ,
50
50
} ;
51
51
52
- Payload :: from_script ( & script) . ok_or ( ConversionError :: InvalidPayload )
52
+ Ok ( Payload :: from_script ( & script) ? )
53
53
}
54
54
55
55
fn from_address ( address : Address ) -> Result < Self , ConversionError > {
You can’t perform that action at this time.
0 commit comments