Merge pull request #30 from notmandatory/allow-creating-a-wallet-with-a-change-descriptor
Allow creating a wallet with a change descriptor
This commit is contained in:
commit
6a25dbfb05
@ -62,7 +62,7 @@ fun main(args: Array<String>) {
|
||||
BlockchainConfig.Electrum(
|
||||
ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 10u)
|
||||
)
|
||||
val wallet = OnlineWallet(descriptor, network, db, client)
|
||||
val wallet = OnlineWallet(descriptor, null, network, db, client)
|
||||
wallet.sync(LogProgress(), null)
|
||||
println("Initial wallet balance: ${wallet.getBalance()}")
|
||||
println("Please send $amount satoshis to address: ${wallet.getNewAddress()}")
|
||||
|
@ -61,7 +61,7 @@ abstract class LibTest {
|
||||
100u
|
||||
)
|
||||
)
|
||||
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
||||
val wallet = OnlineWallet(desc, null, Network.TESTNET, db, client)
|
||||
assertNotNull(wallet)
|
||||
val network = wallet.getNetwork()
|
||||
assertEquals(network, Network.TESTNET)
|
||||
@ -87,7 +87,7 @@ abstract class LibTest {
|
||||
100u
|
||||
)
|
||||
)
|
||||
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
||||
val wallet = OnlineWallet(desc, null, Network.TESTNET, db, client)
|
||||
wallet.sync(LogProgress(), null)
|
||||
val balance = wallet.getBalance()
|
||||
assertTrue(balance > 0u)
|
||||
|
@ -126,7 +126,7 @@ callback interface BdkProgress {
|
||||
|
||||
interface OnlineWallet {
|
||||
[Throws=BdkError]
|
||||
constructor(string descriptor, Network network, DatabaseConfig database_config, BlockchainConfig blockchain_config);
|
||||
constructor(string descriptor, string? change_descriptor, Network network, DatabaseConfig database_config, BlockchainConfig blockchain_config);
|
||||
|
||||
// OfflineWalletOperations
|
||||
string get_new_address();
|
||||
|
@ -193,6 +193,7 @@ impl PartiallySignedBitcoinTransaction {
|
||||
impl OnlineWallet {
|
||||
fn new(
|
||||
descriptor: String,
|
||||
change_descriptor: Option<String>,
|
||||
network: Network,
|
||||
database_config: DatabaseConfig,
|
||||
blockchain_config: BlockchainConfig,
|
||||
@ -225,7 +226,7 @@ impl OnlineWallet {
|
||||
let blockchain = AnyBlockchain::from_config(&any_blockchain_config)?;
|
||||
let wallet = Mutex::new(Wallet::new(
|
||||
&descriptor,
|
||||
None,
|
||||
change_descriptor.to_owned().as_ref(),
|
||||
network,
|
||||
database,
|
||||
blockchain,
|
||||
|
Loading…
x
Reference in New Issue
Block a user