Skip to content

Commit 644f2ed

Browse files
committed
Rename new_funding_address to new_onchain_address
As we're using the `onchain` keyword everywhere in the API to discern onchain-operations (e.g., `send_to_onchain_address`, `spendable_onchain_balance`, etc.) we also align the funding API call here and rename `new_funding_address` to `new_onchain_address`.
1 parent 59b2b8a commit 644f2ed

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

bindings/kotlin/ldk-node-android/lib/src/androidTest/kotlin/org/lightningdevkit/ldknode/AndroidLibTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
1616
@RunWith(AndroidJUnit4::class)
1717
class AndroidLibTest {
1818
@Test fun node_start_stop() {
19-
val network: Network = "regtest"
20-
assertEquals(network, "regtest")
19+
val network = Network.REGTEST
2120

21+
val esplora_url = "http://127.0.0.1:3002"
2222
val tmpDir1 = createTempDirectory("ldk_node").toString()
2323
println("Random dir 1: $tmpDir1")
2424
val tmpDir2 = createTempDirectory("ldk_node").toString()
@@ -27,8 +27,8 @@ class AndroidLibTest {
2727
val listenAddress1 = "127.0.0.1:2323"
2828
val listenAddress2 = "127.0.0.1:2324"
2929

30-
val config1 = Config(tmpDir1, "http://127.0.0.1:3002", network, listenAddress1, 2048u)
31-
val config2 = Config(tmpDir2, "http://127.0.0.1:3002", network, listenAddress2, 2048u)
30+
val config1 = Config(tmpDir1, network, listenAddress1, 2048u)
31+
val config2 = Config(tmpDir2, network, listenAddress2, 2048u)
3232

3333
val builder1 = Builder.fromConfig(config1)
3434
val builder2 = Builder.fromConfig(config2)
@@ -45,10 +45,10 @@ class AndroidLibTest {
4545
val nodeId2 = node2.nodeId()
4646
println("Node Id 2: $nodeId2")
4747

48-
val address1 = node1.newFundingAddress()
48+
val address1 = node1.newOnchainAddress()
4949
println("Funding address 1: $address1")
5050

51-
val address2 = node2.newFundingAddress()
51+
val address2 = node2.newOnchainAddress()
5252
println("Funding address 2: $address2")
5353

5454
node1.stop()

bindings/kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode/LibraryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class LibraryTest {
9191
val nodeId2 = node2.nodeId()
9292
println("Node Id 2: $nodeId2")
9393

94-
val address1 = node1.newFundingAddress()
94+
val address1 = node1.newOnchainAddress()
9595
println("Funding address 1: $address1")
9696

97-
val address2 = node2.newFundingAddress()
97+
val address2 = node2.newOnchainAddress()
9898
println("Funding address 2: $address2")
9999

100100
val txid1 = sendToAddress(address1, 100000u)

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface LDKNode {
3636
PublicKey node_id();
3737
NetAddress? listening_address();
3838
[Throws=NodeError]
39-
Address new_funding_address();
39+
Address new_onchain_address();
4040
[Throws=NodeError]
4141
Txid send_to_onchain_address([ByRef]Address address, u64 amount_msat);
4242
[Throws=NodeError]

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//! let node = builder.build();
4141
//! node.start().unwrap();
4242
//!
43-
//! let _funding_address = node.new_funding_address();
43+
//! let _funding_address = node.new_onchain_address();
4444
//!
4545
//! // .. fund address ..
4646
//!
@@ -1139,7 +1139,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
11391139
}
11401140

11411141
/// Retrieve a new on-chain/funding address.
1142-
pub fn new_funding_address(&self) -> Result<Address, Error> {
1142+
pub fn new_onchain_address(&self) -> Result<Address, Error> {
11431143
let funding_address = self.wallet.get_new_address()?;
11441144
log_info!(self.logger, "Generated new funding address: {}", funding_address);
11451145
Ok(funding_address)

src/test/functional_tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ fn channel_full_cycle() {
1414
builder_a.set_esplora_server(esplora_url.clone());
1515
let node_a = builder_a.build();
1616
node_a.start().unwrap();
17-
let addr_a = node_a.new_funding_address().unwrap();
17+
let addr_a = node_a.new_onchain_address().unwrap();
1818

1919
println!("\n== Node B ==");
2020
let config_b = random_config();
2121
let builder_b = Builder::from_config(config_b);
2222
builder_b.set_esplora_server(esplora_url);
2323
let node_b = builder_b.build();
2424
node_b.start().unwrap();
25-
let addr_b = node_b.new_funding_address().unwrap();
25+
let addr_b = node_b.new_onchain_address().unwrap();
2626

2727
let premine_amount_sat = 100_000;
2828

@@ -239,15 +239,15 @@ fn channel_open_fails_when_funds_insufficient() {
239239
builder_a.set_esplora_server(esplora_url.clone());
240240
let node_a = builder_a.build();
241241
node_a.start().unwrap();
242-
let addr_a = node_a.new_funding_address().unwrap();
242+
let addr_a = node_a.new_onchain_address().unwrap();
243243

244244
println!("\n== Node B ==");
245245
let config_b = random_config();
246246
let builder_b = Builder::from_config(config_b);
247247
builder_b.set_esplora_server(esplora_url);
248248
let node_b = builder_b.build();
249249
node_b.start().unwrap();
250-
let addr_b = node_b.new_funding_address().unwrap();
250+
let addr_b = node_b.new_onchain_address().unwrap();
251251

252252
let premine_amount_sat = 100_000;
253253

@@ -297,7 +297,7 @@ fn start_stop_reinit() {
297297
let node = builder.build();
298298
let expected_node_id = node.node_id();
299299

300-
let funding_address = node.new_funding_address().unwrap();
300+
let funding_address = node.new_onchain_address().unwrap();
301301
let expected_amount = Amount::from_sat(100000);
302302

303303
premine_and_distribute_funds(&bitcoind, &electrsd, vec![funding_address], expected_amount);
@@ -350,14 +350,14 @@ fn onchain_spend_receive() {
350350
builder_a.set_esplora_server(esplora_url.clone());
351351
let node_a = builder_a.build();
352352
node_a.start().unwrap();
353-
let addr_a = node_a.new_funding_address().unwrap();
353+
let addr_a = node_a.new_onchain_address().unwrap();
354354

355355
let config_b = random_config();
356356
let builder_b = Builder::from_config(config_b);
357357
builder_b.set_esplora_server(esplora_url);
358358
let node_b = builder_b.build();
359359
node_b.start().unwrap();
360-
let addr_b = node_b.new_funding_address().unwrap();
360+
let addr_b = node_b.new_onchain_address().unwrap();
361361

362362
premine_and_distribute_funds(
363363
&bitcoind,
@@ -383,7 +383,7 @@ fn onchain_spend_receive() {
383383
assert!(node_b.spendable_onchain_balance_sats().unwrap() > 98000);
384384
assert!(node_b.spendable_onchain_balance_sats().unwrap() < 100000);
385385

386-
let addr_b = node_b.new_funding_address().unwrap();
386+
let addr_b = node_b.new_onchain_address().unwrap();
387387
let txid = node_a.send_all_to_onchain_address(&addr_b).unwrap();
388388
generate_blocks_and_wait(&bitcoind, &electrsd, 6);
389389
wait_for_tx(&electrsd, txid);

0 commit comments

Comments
 (0)