@@ -370,8 +370,11 @@ impl BitcoindChainSource {
370
370
let cur_height = channel_manager. current_best_block ( ) . height ;
371
371
372
372
let now = SystemTime :: now ( ) ;
373
- let unconfirmed_txids = self . onchain_wallet . get_unconfirmed_txids ( ) ;
374
- match self . api_client . get_updated_mempool_transactions ( cur_height, unconfirmed_txids) . await
373
+ let bdk_unconfirmed_txids = self . onchain_wallet . get_unconfirmed_txids ( ) ;
374
+ match self
375
+ . api_client
376
+ . get_updated_mempool_transactions ( cur_height, bdk_unconfirmed_txids)
377
+ . await
375
378
{
376
379
Ok ( ( unconfirmed_txs, evicted_txids) ) => {
377
380
log_trace ! (
@@ -754,7 +757,7 @@ impl BitcoindClient {
754
757
async fn get_raw_transaction_rpc (
755
758
rpc_client : Arc < RpcClient > , txid : & Txid ,
756
759
) -> std:: io:: Result < Option < Transaction > > {
757
- let txid_hex = bitcoin :: consensus :: encode :: serialize_hex ( txid) ;
760
+ let txid_hex = txid. to_string ( ) ;
758
761
let txid_json = serde_json:: json!( txid_hex) ;
759
762
match rpc_client
760
763
. call_method :: < GetRawTransactionResponse > ( "getrawtransaction" , & [ txid_json] )
@@ -792,7 +795,7 @@ impl BitcoindClient {
792
795
async fn get_raw_transaction_rest (
793
796
rest_client : Arc < RestClient > , txid : & Txid ,
794
797
) -> std:: io:: Result < Option < Transaction > > {
795
- let txid_hex = bitcoin :: consensus :: encode :: serialize_hex ( txid) ;
798
+ let txid_hex = txid. to_string ( ) ;
796
799
let tx_path = format ! ( "tx/{}.json" , txid_hex) ;
797
800
match rest_client
798
801
. request_resource :: < JsonResponse , GetRawTransactionResponse > ( & tx_path)
@@ -889,7 +892,7 @@ impl BitcoindClient {
889
892
async fn get_mempool_entry_inner (
890
893
client : Arc < RpcClient > , txid : Txid ,
891
894
) -> std:: io:: Result < Option < MempoolEntry > > {
892
- let txid_hex = bitcoin :: consensus :: encode :: serialize_hex ( & txid) ;
895
+ let txid_hex = txid. to_string ( ) ;
893
896
let txid_json = serde_json:: json!( txid_hex) ;
894
897
895
898
match client. call_method :: < GetMempoolEntryResponse > ( "getmempoolentry" , & [ txid_json] ) . await {
@@ -964,11 +967,12 @@ impl BitcoindClient {
964
967
/// - mempool transactions, alongside their first-seen unix timestamps.
965
968
/// - transactions that have been evicted from the mempool, alongside the last time they were seen absent.
966
969
pub ( crate ) async fn get_updated_mempool_transactions (
967
- & self , best_processed_height : u32 , unconfirmed_txids : Vec < Txid > ,
970
+ & self , best_processed_height : u32 , bdk_unconfirmed_txids : Vec < Txid > ,
968
971
) -> std:: io:: Result < ( Vec < ( Transaction , u64 ) > , Vec < ( Txid , u64 ) > ) > {
969
972
let mempool_txs =
970
973
self . get_mempool_transactions_and_timestamp_at_height ( best_processed_height) . await ?;
971
- let evicted_txids = self . get_evicted_mempool_txids_and_timestamp ( unconfirmed_txids) . await ?;
974
+ let evicted_txids =
975
+ self . get_evicted_mempool_txids_and_timestamp ( bdk_unconfirmed_txids) . await ?;
972
976
Ok ( ( mempool_txs, evicted_txids) )
973
977
}
974
978
@@ -1078,22 +1082,22 @@ impl BitcoindClient {
1078
1082
// To this end, we first update our local mempool_entries_cache and then return all unconfirmed
1079
1083
// wallet `Txid`s that don't appear in the mempool still.
1080
1084
async fn get_evicted_mempool_txids_and_timestamp (
1081
- & self , unconfirmed_txids : Vec < Txid > ,
1085
+ & self , bdk_unconfirmed_txids : Vec < Txid > ,
1082
1086
) -> std:: io:: Result < Vec < ( Txid , u64 ) > > {
1083
1087
match self {
1084
1088
BitcoindClient :: Rpc { latest_mempool_timestamp, mempool_entries_cache, .. } => {
1085
1089
Self :: get_evicted_mempool_txids_and_timestamp_inner (
1086
1090
latest_mempool_timestamp,
1087
1091
mempool_entries_cache,
1088
- unconfirmed_txids ,
1092
+ bdk_unconfirmed_txids ,
1089
1093
)
1090
1094
. await
1091
1095
} ,
1092
1096
BitcoindClient :: Rest { latest_mempool_timestamp, mempool_entries_cache, .. } => {
1093
1097
Self :: get_evicted_mempool_txids_and_timestamp_inner (
1094
1098
latest_mempool_timestamp,
1095
1099
mempool_entries_cache,
1096
- unconfirmed_txids ,
1100
+ bdk_unconfirmed_txids ,
1097
1101
)
1098
1102
. await
1099
1103
} ,
@@ -1103,13 +1107,13 @@ impl BitcoindClient {
1103
1107
async fn get_evicted_mempool_txids_and_timestamp_inner (
1104
1108
latest_mempool_timestamp : & AtomicU64 ,
1105
1109
mempool_entries_cache : & tokio:: sync:: Mutex < HashMap < Txid , MempoolEntry > > ,
1106
- unconfirmed_txids : Vec < Txid > ,
1110
+ bdk_unconfirmed_txids : Vec < Txid > ,
1107
1111
) -> std:: io:: Result < Vec < ( Txid , u64 ) > > {
1108
1112
let latest_mempool_timestamp = latest_mempool_timestamp. load ( Ordering :: Relaxed ) ;
1109
1113
let mempool_entries_cache = mempool_entries_cache. lock ( ) . await ;
1110
- let evicted_txids = unconfirmed_txids
1114
+ let evicted_txids = bdk_unconfirmed_txids
1111
1115
. into_iter ( )
1112
- . filter ( |txid| mempool_entries_cache. contains_key ( txid) )
1116
+ . filter ( |txid| ! mempool_entries_cache. contains_key ( txid) )
1113
1117
. map ( |txid| ( txid, latest_mempool_timestamp) )
1114
1118
. collect ( ) ;
1115
1119
Ok ( evicted_txids)
@@ -1236,7 +1240,7 @@ impl TryInto<GetRawMempoolResponse> for JsonResponse {
1236
1240
1237
1241
for hex in res {
1238
1242
let txid = if let Some ( hex_str) = hex. as_str ( ) {
1239
- match bitcoin :: consensus :: encode :: deserialize_hex ( hex_str ) {
1243
+ match hex_str . parse :: < Txid > ( ) {
1240
1244
Ok ( txid) => txid,
1241
1245
Err ( _) => {
1242
1246
return Err ( std:: io:: Error :: new (
0 commit comments