X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FKeysManager.java;h=d92016a7adc00ffedda263a53974efb7fd1d9bd6;hb=5e9de82b3a7712a41189756d9d16d946142b2ac5;hp=0876219eeb1e51abcae8fdb7f60b04edae88a028;hpb=d2925e24ac4643ec22eb73495f0424e27def2545;p=ldk-java diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java index 0876219e..d92016a7 100644 --- a/src/main/java/org/ldk/structs/KeysManager.java +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -16,6 +16,12 @@ import javax.annotation.Nullable; * ChannelMonitor closes may use seed/1' * Cooperative closes may use seed/2' * The two close keys may be needed to claim on-chain funds! + * + * This struct cannot be used for nodes that wish to support receiving phantom payments; + * [`PhantomKeysManager`] must be used instead. + * + * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any + * previously issued invoices and attempts to pay previous invoices will fail. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class KeysManager extends CommonBase { @@ -53,8 +59,8 @@ public class KeysManager extends CommonBase { Reference.reachabilityFence(starting_time_secs); Reference.reachabilityFence(starting_time_nanos); if (ret >= 0 && ret <= 4096) { return null; } - KeysManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new KeysManager(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); + org.ldk.structs.KeysManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.KeysManager(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -71,8 +77,8 @@ public class KeysManager extends CommonBase { Reference.reachabilityFence(channel_value_satoshis); Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } - InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InMemorySigner(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -81,8 +87,9 @@ public class KeysManager extends CommonBase { * output to the given change destination (if sufficient change value remains). The * transaction will have a feerate, at least, of the given value. * - * Returns `Err(())` if the output value is greater than the input value minus required fee or - * if a descriptor was duplicated. + * Returns `Err(())` if the output value is greater than the input value minus required fee, + * if a descriptor was duplicated, or if an output descriptor `script_pubkey` + * does not match the one we can spend. * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. * @@ -110,7 +117,7 @@ public class KeysManager extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } KeysInterface ret_hu_conv = new KeysInterface(null, ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; }