]> git.bitcoin.ninja Git - rust-lightning/commitdiff
[bindings] Update demos for new upstream API
authorMatt Corallo <git@bluematt.me>
Sat, 6 Mar 2021 00:09:26 +0000 (19:09 -0500)
committerMatt Corallo <git@bluematt.me>
Sun, 7 Mar 2021 18:06:07 +0000 (13:06 -0500)
lightning-c-bindings/demo.c
lightning-c-bindings/demo.cpp

index 3f7c4be9d2fe2b9307d51173f15702c995a5949e..d9508c59e6485aec84aa76cff0937c56deb32214 100644 (file)
@@ -72,8 +72,10 @@ int main() {
        LDKKeysInterface keys_source = KeysManager_as_KeysInterface(&keys);
 
        LDKUserConfig config = UserConfig_default();
-
-       LDKChannelManager cm = ChannelManager_new(net, fee_est, mon, broadcast, logger, keys_source, config, 0);
+       LDKThirtyTwoBytes chain_tip;
+       memset(&chain_tip, 0, 32);
+       LDKChainParameters chain = ChainParameters_new(net, chain_tip, 0);
+       LDKChannelManager cm = ChannelManager_new(fee_est, mon, broadcast, logger, keys_source, config, chain);
 
        LDKCVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm);
        assert((unsigned long)channels.data < 4096); // There's an offset, but it should still be an offset against null in the 0 page
index 84f27448a33f76259f064105e627d8ec2c7e558a..230d0c0c92f762ad7a30a840108f72ab052461b3 100644 (file)
@@ -292,6 +292,8 @@ int main() {
        memset(&null_pk, 0, sizeof(null_pk));
 
        LDKThirtyTwoBytes random_bytes;
+       LDKThirtyTwoBytes chain_tip;
+       memset(&chain_tip, 0, sizeof(chain_tip)); // channel_open_header's prev_blockhash is all-0s
 
        LDKNetwork network = LDKNetwork_Testnet;
 
@@ -352,7 +354,7 @@ int main() {
                LDK::KeysInterface keys_source1 = KeysManager_as_KeysInterface(&keys1);
                node_secret1 = keys_source1->get_node_secret(keys_source1->this_arg);
 
-               LDK::ChannelManager cm1 = ChannelManager_new(network, fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), UserConfig_default(), 0);
+               LDK::ChannelManager cm1 = ChannelManager_new(fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), UserConfig_default(), ChainParameters_new(network, chain_tip, 0));
 
                LDK::CVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm1);
                assert(channels->datalen == 0);
@@ -379,7 +381,7 @@ int main() {
                LDK::UserConfig config2 = UserConfig_default();
                UserConfig_set_own_channel_config(&config2, std::move(handshake_config2));
 
-               LDK::ChannelManager cm2 = ChannelManager_new(network, fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), 0);
+               LDK::ChannelManager cm2 = ChannelManager_new(fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), ChainParameters_new(network, chain_tip, 0));
 
                LDK::CVec_ChannelDetailsZ channels2 = ChannelManager_list_channels(&cm2);
                assert(channels2->datalen == 0);