Skip to content

Commit 4be75f9

Browse files
refactor: adapt to btck_api changes kernelApi_63 with trait-based API
- replace generic RefType<T,L> with specific reference types (ScriptPubkeyRef, TxOutRef, etc.) - Add trait-based API with *Ext traits for common operations across owned/borrowed types - Add prelude module for trait imports - Update BlockTreeNetry::prev() to return Option instead of Result - Fix notification callback parameter from mutable to const pointer
1 parent 19545c1 commit 4be75f9

File tree

3 files changed

+641
-374
lines changed

3 files changed

+641
-374
lines changed

examples/src/silentpaymentscanner.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use bitcoin::consensus::deserialize;
77
use bitcoin::hashes::Hash;
88
use bitcoin::{PrivateKey, XOnlyPublicKey};
99
use bitcoinkernel::{
10-
ChainType, ChainstateManager, ChainstateManagerOptions, Context, ContextBuilder, KernelError,
11-
Log, Logger,
10+
prelude::*, ChainType, ChainstateManager, ChainstateManagerOptions, Context, ContextBuilder,
11+
KernelError, Log, Logger,
1212
};
1313
use env_logger::Builder;
1414
use log::LevelFilter;
@@ -195,7 +195,7 @@ fn scan_txs(chainman: &ChainstateManager) {
195195
for j in 0..transaction_input_size {
196196
let coin = tx_spent_outputs.coin(j).unwrap();
197197
scan_tx_helper.ins.push(Input {
198-
prevout: coin.output().unwrap().script_pubkey().to_bytes(),
198+
prevout: coin.output().script_pubkey().to_bytes(),
199199
script_sig: block.txdata[i + 1].input[j].script_sig.to_bytes(),
200200
witness: block.txdata[i + 1].input[j].witness.to_vec(),
201201
prevout_data: (
@@ -212,8 +212,8 @@ fn scan_txs(chainman: &ChainstateManager) {
212212
println!("helper: {:?}", scan_tx_helper);
213213
}
214214
block_index = match block_index.prev() {
215-
Ok(block_index_prev) => block_index_prev,
216-
Err(_) => break,
215+
Some(block_index_prev) => block_index_prev,
216+
None => break,
217217
};
218218
}
219219
log::info!("scanned txs!");

0 commit comments

Comments
 (0)