]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Update to LDK 0.0.121
authoroptout <13562139+optout21@users.noreply.github.com>
Thu, 1 Feb 2024 12:22:54 +0000 (13:22 +0100)
committeroptout <13562139+optout21@users.noreply.github.com>
Thu, 1 Feb 2024 12:22:54 +0000 (13:22 +0100)
.github/workflows/build.yml
Cargo.lock
Cargo.toml
src/bitcoind_client.rs
src/cli.rs
src/convert.rs
src/disk.rs
src/main.rs
src/sweep.rs

index 3b9e46ac51a476b98e245aa77540be453b69e010..8fb8095a9941ee80565d9adc5368dcf5bfc14fdd 100644 (file)
@@ -7,13 +7,13 @@ jobs:
     strategy:
       matrix:
         platform: [ ubuntu-latest, macos-latest, windows-latest ]
-        toolchain: [ stable, 1.48.0 ]
+        toolchain: [ stable, 1.63.0 ]
         include:
           - toolchain: stable
             check-fmt: true
         exclude:
           - platform: macos-latest
-            toolchain: 1.48.0
+            toolchain: 1.63.0
           - platform: windows-latest
             toolchain: stable
     runs-on: ${{ matrix.platform }}
index 454cddb8c220ae0fa7fd252c47b772b7f94a8b36..20f8866bfdf452b8c32068b885b06111ad5d340f 100644 (file)
@@ -2,6 +2,21 @@
 # It is not intended for manual editing.
 version = 3
 
+[[package]]
+name = "addr2line"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
 [[package]]
 name = "android_system_properties"
 version = "0.1.5"
@@ -17,6 +32,21 @@ version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
 
+[[package]]
+name = "backtrace"
+version = "0.3.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
 [[package]]
 name = "base64"
 version = "0.13.1"
@@ -37,12 +67,14 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445"
 
 [[package]]
 name = "bitcoin"
-version = "0.29.2"
+version = "0.30.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3"
+checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462"
 dependencies = [
  "bech32 0.9.1",
+ "bitcoin-private",
  "bitcoin_hashes",
+ "hex_lit",
  "secp256k1",
 ]
 
@@ -55,11 +87,20 @@ dependencies = [
  "bech32 0.8.1",
 ]
 
+[[package]]
+name = "bitcoin-private"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57"
+
 [[package]]
 name = "bitcoin_hashes"
-version = "0.11.0"
+version = "0.12.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4"
+checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501"
+dependencies = [
+ "bitcoin-private",
+]
 
 [[package]]
 name = "bumpalo"
@@ -92,11 +133,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
 dependencies = [
  "iana-time-zone",
- "js-sys",
  "num-integer",
  "num-traits",
- "time",
- "wasm-bindgen",
  "winapi",
 ]
 
@@ -146,7 +184,7 @@ dependencies = [
  "proc-macro2",
  "quote",
  "scratch",
- "syn",
+ "syn 1.0.107",
 ]
 
 [[package]]
@@ -163,7 +201,7 @@ checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.107",
 ]
 
 [[package]]
@@ -172,6 +210,12 @@ version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
 
+[[package]]
+name = "gimli"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+
 [[package]]
 name = "hermit-abi"
 version = "0.2.6"
@@ -181,6 +225,18 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "hex-conservative"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2"
+
+[[package]]
+name = "hex_lit"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd"
+
 [[package]]
 name = "iana-time-zone"
 version = "0.1.53"
@@ -244,24 +300,25 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.139"
+version = "0.2.151"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
 
 [[package]]
 name = "lightning"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90a0f2155316f1570446a0447c993480673f840748c8ed25bbc59dfc442ac770"
+checksum = "5b0c1f811ae288f86c6767055c55b5f7a721ca1e61bf1897a9ae2ec663e8aba1"
 dependencies = [
  "bitcoin",
+ "hex-conservative",
 ]
 
 [[package]]
 name = "lightning-background-processor"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "398b68a96cceb3c1227504bd5faeb74f26c3233447bc10cc1cb2c67e01b51556"
+checksum = "57d4711ad9cc33f30c2e8e876fcfd6255523fc250440abb8c374cd98e6c40e79"
 dependencies = [
  "bitcoin",
  "lightning",
@@ -270,25 +327,26 @@ dependencies = [
 
 [[package]]
 name = "lightning-block-sync"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d94c276dbe2a777d58ed6ececca96006247a4717c00ac4cdfff62d76852be783"
+checksum = "dcb75d3aca909b77ee21b2e26714c370bdc3246734fa3d4355afa503cb3c0feb"
 dependencies = [
  "bitcoin",
  "chunked_transfer",
+ "hex-conservative",
  "lightning",
  "serde_json",
+ "tokio",
 ]
 
 [[package]]
 name = "lightning-invoice"
-version = "0.24.0"
+version = "0.29.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1788c0158526ec27a502043c2911ea6ea58fdc656bdf8749484942c07b790d23"
+checksum = "5b186aca4a605d4db3b85979922be287b9ebd5dedd8132963bb9dbeb8f7d2a04"
 dependencies = [
  "bech32 0.9.1",
  "bitcoin",
- "bitcoin_hashes",
  "lightning",
  "num-traits",
  "secp256k1",
@@ -296,9 +354,9 @@ dependencies = [
 
 [[package]]
 name = "lightning-net-tokio"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "366c0ae225736cbc03555bd5fb4b44b2e8fe2ca3c868ec53a4b325c38b2ab2bd"
+checksum = "4813cca14ed984924a6975895e80cde8673a0a105a1c7ddf3b0fb3d1ce59e6bf"
 dependencies = [
  "bitcoin",
  "lightning",
@@ -307,21 +365,20 @@ dependencies = [
 
 [[package]]
 name = "lightning-persister"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93caaafeb42115b70119619c2420e362cce776670427fc4ced3e6df77b41c0b6"
+checksum = "a82a633e4d08b75e16dc131af2961254b7005c30ab29577e215080d2943c0511"
 dependencies = [
  "bitcoin",
- "libc",
  "lightning",
- "winapi",
+ "windows-sys",
 ]
 
 [[package]]
 name = "lightning-rapid-gossip-sync"
-version = "0.0.116"
+version = "0.0.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a07af5814234924e623bca499e003fca1864024d5bd984e752230f73a131584"
+checksum = "128d6c450cb698b46ecacc6645ebeb2b57d6f9458482635ab523863fa8378314"
 dependencies = [
  "bitcoin",
  "lightning",
@@ -352,34 +409,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
 
 [[package]]
-name = "mio"
-version = "0.7.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
-dependencies = [
- "libc",
- "log",
- "miow",
- "ntapi",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.7"
+name = "miniz_oxide"
+version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
+checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
 dependencies = [
- "winapi",
+ "adler",
 ]
 
 [[package]]
-name = "ntapi"
-version = "0.3.7"
+name = "mio"
+version = "0.8.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
+checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
 dependencies = [
- "winapi",
+ "libc",
+ "wasi",
+ "windows-sys",
 ]
 
 [[package]]
@@ -411,6 +457,15 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "object"
+version = "0.32.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
+dependencies = [
+ "memchr",
+]
+
 [[package]]
 name = "once_cell"
 version = "1.17.0"
@@ -419,24 +474,24 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
 
 [[package]]
 name = "pin-project-lite"
-version = "0.2.9"
+version = "0.2.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.49"
+version = "1.0.75"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
+checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708"
 dependencies = [
  "unicode-ident",
 ]
 
 [[package]]
 name = "quote"
-version = "1.0.23"
+version = "1.0.35"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
 dependencies = [
  "proc-macro2",
 ]
@@ -478,6 +533,12 @@ dependencies = [
  "rand_core 0.3.1",
 ]
 
+[[package]]
+name = "rustc-demangle"
+version = "0.1.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
+
 [[package]]
 name = "ryu"
 version = "1.0.12"
@@ -492,9 +553,9 @@ checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
 
 [[package]]
 name = "secp256k1"
-version = "0.24.2"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3"
+checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
 dependencies = [
  "bitcoin_hashes",
  "secp256k1-sys",
@@ -502,9 +563,9 @@ dependencies = [
 
 [[package]]
 name = "secp256k1-sys"
-version = "0.6.1"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b"
+checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e"
 dependencies = [
  "cc",
 ]
@@ -526,6 +587,16 @@ dependencies = [
  "serde",
 ]
 
+[[package]]
+name = "socket2"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
 [[package]]
 name = "syn"
 version = "1.0.107"
@@ -538,51 +609,51 @@ dependencies = [
 ]
 
 [[package]]
-name = "termcolor"
-version = "1.1.3"
+name = "syn"
+version = "2.0.47"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
+checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb"
 dependencies = [
- "winapi-util",
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
 ]
 
 [[package]]
-name = "time"
-version = "0.1.45"
+name = "termcolor"
+version = "1.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
+checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
 dependencies = [
- "libc",
- "wasi",
- "winapi",
+ "winapi-util",
 ]
 
 [[package]]
 name = "tokio"
-version = "1.14.1"
+version = "1.35.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d0183f6f6001549ab68f8c7585093bb732beefbcf6d23a10b9b95c73a1dd49"
+checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
 dependencies = [
- "autocfg",
+ "backtrace",
  "bytes",
  "libc",
- "memchr",
  "mio",
  "num_cpus",
  "pin-project-lite",
+ "socket2",
  "tokio-macros",
- "winapi",
+ "windows-sys",
 ]
 
 [[package]]
 name = "tokio-macros"
-version = "1.8.2"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.47",
 ]
 
 [[package]]
@@ -599,9 +670,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
 
 [[package]]
 name = "wasi"
-version = "0.10.0+wasi-snapshot-preview1"
+version = "0.11.0+wasi-snapshot-preview1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
 
 [[package]]
 name = "wasm-bindgen"
@@ -624,7 +695,7 @@ dependencies = [
  "once_cell",
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.107",
  "wasm-bindgen-shared",
 ]
 
@@ -646,7 +717,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.107",
  "wasm-bindgen-backend",
  "wasm-bindgen-shared",
 ]
@@ -687,3 +758,69 @@ name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
index dac94fb7d916c24ff9a9c793fdff59c7825507a3..99699ebef7e2928e27f337d5f269d5e3ee314cc2 100644 (file)
@@ -8,16 +8,16 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-lightning = { version = "0.0.118", features = ["max_level_trace"] }
-lightning-block-sync = { version = "0.0.118", features = [ "rpc-client", "tokio" ] }
-lightning-invoice = { version = "0.26.0" }
-lightning-net-tokio = { version = "0.0.118" }
-lightning-persister = { version = "0.0.118" }
-lightning-background-processor = { version = "0.0.118", features = [ "futures" ] }
-lightning-rapid-gossip-sync = { version = "0.0.118" }
+lightning = { version = "0.0.121", features = ["max_level_trace"] }
+lightning-block-sync = { version = "0.0.121", features = [ "rpc-client", "tokio" ] }
+lightning-invoice = { version = "0.29.0" }
+lightning-net-tokio = { version = "0.0.121" }
+lightning-persister = { version = "0.0.121" }
+lightning-background-processor = { version = "0.0.121", features = [ "futures" ] }
+lightning-rapid-gossip-sync = { version = "0.0.121" }
 
 base64 = "0.13.0"
-bitcoin = "0.29.0"
+bitcoin = "0.30.2"
 bitcoin-bech32 = "0.12"
 bech32 = "0.8"
 libc = "0.2"
index 17ea74c1e4e8b644487a7ecd12c84a141d81f609..c00f52fb752cdd033e69c9cc60085a213db6fec2 100644 (file)
@@ -5,13 +5,16 @@ use crate::convert::{
 use crate::disk::FilesystemLogger;
 use crate::hex_utils;
 use base64;
+use bitcoin::address::{Address, Payload, WitnessVersion};
 use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
+use bitcoin::blockdata::script::ScriptBuf;
 use bitcoin::blockdata::transaction::Transaction;
 use bitcoin::consensus::{encode, Decodable, Encodable};
 use bitcoin::hash_types::{BlockHash, Txid};
 use bitcoin::hashes::Hash;
-use bitcoin::util::address::{Address, Payload, WitnessVersion};
-use bitcoin::{OutPoint, Script, TxOut, WPubkeyHash, XOnlyPublicKey};
+use bitcoin::key::XOnlyPublicKey;
+use bitcoin::psbt::PartiallySignedTransaction;
+use bitcoin::{Network, OutPoint, TxOut, WPubkeyHash};
 use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
 use lightning::events::bump_transaction::{Utxo, WalletSource};
 use lightning::log_error;
@@ -28,6 +31,7 @@ use std::time::Duration;
 
 pub struct BitcoindClient {
        pub(crate) bitcoind_rpc_client: Arc<RpcClient>,
+       network: Network,
        host: String,
        port: u16,
        rpc_user: String,
@@ -60,7 +64,7 @@ const MIN_FEERATE: u32 = 253;
 
 impl BitcoindClient {
        pub(crate) async fn new(
-               host: String, port: u16, rpc_user: String, rpc_password: String,
+               host: String, port: u16, rpc_user: String, rpc_password: String, network: Network,
                handle: tokio::runtime::Handle, logger: Arc<FilesystemLogger>,
        ) -> std::io::Result<Self> {
                let http_endpoint = HttpEndpoint::for_host(host.clone()).with_port(port);
@@ -76,10 +80,6 @@ impl BitcoindClient {
                        })?;
                let mut fees: HashMap<ConfirmationTarget, AtomicU32> = HashMap::new();
                fees.insert(ConfirmationTarget::OnChainSweep, AtomicU32::new(5000));
-               fees.insert(
-                       ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
-                       AtomicU32::new(25 * 250),
-               );
                fees.insert(
                        ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
                        AtomicU32::new(MIN_FEERATE),
@@ -98,6 +98,7 @@ impl BitcoindClient {
                        port,
                        rpc_user,
                        rpc_password,
+                       network,
                        fees: Arc::new(fees),
                        handle: handle.clone(),
                        logger,
@@ -178,9 +179,6 @@ impl BitcoindClient {
                                fees.get(&ConfirmationTarget::OnChainSweep)
                                        .unwrap()
                                        .store(high_prio_estimate, Ordering::Release);
-                               fees.get(&ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee)
-                                       .unwrap()
-                                       .store(std::cmp::max(25 * 250, high_prio_estimate * 10), Ordering::Release);
                                fees.get(&ConfirmationTarget::MinAllowedAnchorChannelRemoteFee)
                                        .unwrap()
                                        .store(mempoolmin_estimate, Ordering::Release);
@@ -264,7 +262,7 @@ impl BitcoindClient {
                        .call_method::<NewAddress>("getnewaddress", &addr_args)
                        .await
                        .unwrap();
-               Address::from_str(addr.0.as_str()).unwrap()
+               Address::from_str(addr.0.as_str()).unwrap().require_network(self.network).unwrap()
        }
 
        pub async fn get_blockchain_info(&self) -> BlockchainInfo {
@@ -328,18 +326,18 @@ impl WalletSource for BitcoindClient {
                        .into_iter()
                        .filter_map(|utxo| {
                                let outpoint = OutPoint { txid: utxo.txid, vout: utxo.vout };
-                               match utxo.address.payload {
-                                       Payload::WitnessProgram { version, ref program } => match version {
-                                               WitnessVersion::V0 => WPubkeyHash::from_slice(program)
+                               match utxo.address.payload.clone() {
+                                       Payload::WitnessProgram(wp) => match wp.version() {
+                                               WitnessVersion::V0 => WPubkeyHash::from_slice(wp.program().as_bytes())
                                                        .map(|wpkh| Utxo::new_v0_p2wpkh(outpoint, utxo.amount, &wpkh))
                                                        .ok(),
                                                // TODO: Add `Utxo::new_v1_p2tr` upstream.
-                                               WitnessVersion::V1 => XOnlyPublicKey::from_slice(program)
+                                               WitnessVersion::V1 => XOnlyPublicKey::from_slice(wp.program().as_bytes())
                                                        .map(|_| Utxo {
                                                                outpoint,
                                                                output: TxOut {
                                                                        value: utxo.amount,
-                                                                       script_pubkey: Script::new_witness_program(version, program),
+                                                                       script_pubkey: ScriptBuf::new_witness_program(&wp),
                                                                },
                                                                satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
                                                                        1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
@@ -353,15 +351,15 @@ impl WalletSource for BitcoindClient {
                        .collect())
        }
 
-       fn get_change_script(&self) -> Result<Script, ()> {
+       fn get_change_script(&self) -> Result<ScriptBuf, ()> {
                tokio::task::block_in_place(move || {
                        Ok(self.handle.block_on(async move { self.get_new_address().await.script_pubkey() }))
                })
        }
 
-       fn sign_tx(&self, tx: Transaction) -> Result<Transaction, ()> {
+       fn sign_psbt(&self, tx: PartiallySignedTransaction) -> Result<Transaction, ()> {
                let mut tx_bytes = Vec::new();
-               let _ = tx.consensus_encode(&mut tx_bytes).map_err(|_| ());
+               let _ = tx.unsigned_tx.consensus_encode(&mut tx_bytes).map_err(|_| ());
                let tx_hex = hex_utils::hex_str(&tx_bytes);
                let signed_tx = tokio::task::block_in_place(move || {
                        self.handle.block_on(async move { self.sign_raw_transaction_with_wallet(tx_hex).await })
index 1856cbdda42dac90d01718dedd73b50d5819d2c6..e3487421373c74ad6ae862fefe8f53119551edff 100644 (file)
@@ -11,15 +11,14 @@ use bitcoin::secp256k1::PublicKey;
 use lightning::ln::channelmanager::{PaymentId, RecipientOnionFields, Retry};
 use lightning::ln::msgs::SocketAddress;
 use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage};
-use lightning::onion_message::OnionMessagePath;
-use lightning::onion_message::{Destination, OnionMessageContents};
+use lightning::onion_message::messenger::Destination;
+use lightning::onion_message::packet::OnionMessageContents;
 use lightning::routing::gossip::NodeId;
 use lightning::routing::router::{PaymentParameters, RouteParameters};
 use lightning::sign::{EntropySource, KeysManager};
 use lightning::util::config::{ChannelHandshakeConfig, ChannelHandshakeLimits, UserConfig};
 use lightning::util::persist::KVStore;
 use lightning::util::ser::{Writeable, Writer};
-use lightning_invoice::payment::pay_invoice;
 use lightning_invoice::{utils, Bolt11Invoice, Currency};
 use lightning_persister::fs_store::FilesystemStore;
 use std::env;
@@ -43,6 +42,7 @@ pub(crate) struct LdkUserInfo {
        pub(crate) network: Network,
 }
 
+#[derive(Debug)]
 struct UserOnionMessageContents {
        tlv_type: u64,
        data: Vec<u8>,
@@ -442,13 +442,14 @@ pub(crate) fn poll_for_user_input(
                                                }
                                        };
                                        let destination = Destination::Node(intermediate_nodes.pop().unwrap());
-                                       let message_path = OnionMessagePath { intermediate_nodes, destination };
                                        match onion_messenger.send_onion_message(
-                                               message_path,
                                                UserOnionMessageContents { tlv_type, data },
+                                               destination,
                                                None,
                                        ) {
-                                               Ok(()) => println!("SUCCESS: forwarded onion message to first hop"),
+                                               Ok(success) => {
+                                                       println!("SUCCESS: forwarded onion message to first hop {:?}", success)
+                                               }
                                                Err(e) => println!("ERROR: failed to send onion message: {:?}", e),
                                        }
                                }
@@ -672,7 +673,7 @@ fn open_channel(
                ..Default::default()
        };
 
-       match channel_manager.create_channel(peer_pubkey, channel_amt_sat, 0, 0, Some(config)) {
+       match channel_manager.create_channel(peer_pubkey, channel_amt_sat, 0, 0, None, Some(config)) {
                Ok(_) => {
                        println!("EVENT: initiated channel with peer {}. ", peer_pubkey);
                        return Ok(());
@@ -688,7 +689,8 @@ fn send_payment(
        channel_manager: &ChannelManager, invoice: &Bolt11Invoice,
        outbound_payments: &mut OutboundPaymentInfoStorage, fs_store: Arc<FilesystemStore>,
 ) {
-       let payment_id = PaymentId((*invoice.payment_hash()).into_inner());
+       let payment_id = PaymentId((*invoice.payment_hash()).to_byte_array());
+       let payment_hash = PaymentHash((*invoice.payment_hash()).to_byte_array());
        let payment_secret = Some(*invoice.payment_secret());
        outbound_payments.payments.insert(
                payment_id,
@@ -700,8 +702,51 @@ fn send_payment(
                },
        );
        fs_store.write("", "", OUTBOUND_PAYMENTS_FNAME, &outbound_payments.encode()).unwrap();
-       match pay_invoice(invoice, Retry::Timeout(Duration::from_secs(10)), channel_manager) {
-               Ok(_payment_id) => {
+
+       let mut recipient_onion = RecipientOnionFields::secret_only(*invoice.payment_secret());
+       recipient_onion.payment_metadata = invoice.payment_metadata().map(|v| v.clone());
+       let mut payment_params = match PaymentParameters::from_node_id(
+               invoice.recover_payee_pub_key(),
+               invoice.min_final_cltv_expiry_delta() as u32,
+       )
+       .with_expiry_time(
+               invoice.duration_since_epoch().as_secs().saturating_add(invoice.expiry_time().as_secs()),
+       )
+       .with_route_hints(invoice.route_hints())
+       {
+               Err(e) => {
+                       println!("ERROR: Could not process invoice to prepare payment parameters, {:?}, invoice: {:?}", e, invoice);
+                       return;
+               }
+               Ok(p) => p,
+       };
+       if let Some(features) = invoice.features() {
+               payment_params = match payment_params.with_bolt11_features(features.clone()) {
+                       Err(e) => {
+                               println!("ERROR: Could not build BOLT11 payment parameters! {:?}", e);
+                               return;
+                       }
+                       Ok(p) => p,
+               };
+       }
+       let invoice_amount = match invoice.amount_milli_satoshis() {
+               None => {
+                       println!("ERROR: An invoice with an amount is expected; {:?}", invoice);
+                       return;
+               }
+               Some(a) => a,
+       };
+       let route_params =
+               RouteParameters::from_payment_params_and_value(payment_params, invoice_amount);
+
+       match channel_manager.send_payment(
+               payment_hash,
+               recipient_onion,
+               payment_id,
+               route_params,
+               Retry::Timeout(Duration::from_secs(10)),
+       ) {
+               Ok(_) => {
                        let payee_pubkey = invoice.recover_payee_pub_key();
                        let amt_msat = invoice.amount_milli_satoshis().unwrap();
                        println!("EVENT: initiated sending {} msats to {}", amt_msat, payee_pubkey);
@@ -721,7 +766,7 @@ fn keysend<E: EntropySource>(
        outbound_payments: &mut OutboundPaymentInfoStorage, fs_store: Arc<FilesystemStore>,
 ) {
        let payment_preimage = PaymentPreimage(entropy_source.get_secure_random_bytes());
-       let payment_id = PaymentId(Sha256::hash(&payment_preimage.0[..]).into_inner());
+       let payment_id = PaymentId(Sha256::hash(&payment_preimage.0[..]).to_byte_array());
 
        let route_params = RouteParameters::from_payment_params_and_value(
                PaymentParameters::for_keysend(payee_pubkey, 40, false),
@@ -764,9 +809,9 @@ fn get_invoice(
 ) {
        let currency = match network {
                Network::Bitcoin => Currency::Bitcoin,
-               Network::Testnet => Currency::BitcoinTestnet,
                Network::Regtest => Currency::Regtest,
                Network::Signet => Currency::Signet,
+               Network::Testnet | _ => Currency::BitcoinTestnet,
        };
        let invoice = match utils::create_invoice_from_channelmanager(
                channel_manager,
@@ -788,7 +833,7 @@ fn get_invoice(
                }
        };
 
-       let payment_hash = PaymentHash(invoice.payment_hash().clone().into_inner());
+       let payment_hash = PaymentHash(invoice.payment_hash().to_byte_array());
        inbound_payments.payments.insert(
                payment_hash,
                PaymentInfo {
index 7f1bf108828753df82a0a754e82c22bc332a8664..686761fffdc97b138361c5b251298e1e628f2596 100644 (file)
@@ -1,4 +1,3 @@
-use bitcoin::hashes::hex::FromHex;
 use bitcoin::{Address, BlockHash, Txid};
 use lightning_block_sync::http::JsonResponse;
 use std::convert::TryInto;
@@ -111,7 +110,7 @@ impl TryInto<BlockchainInfo> for JsonResponse {
        fn try_into(self) -> std::io::Result<BlockchainInfo> {
                Ok(BlockchainInfo {
                        latest_height: self.0["blocks"].as_u64().unwrap() as usize,
-                       latest_blockhash: BlockHash::from_hex(self.0["bestblockhash"].as_str().unwrap())
+                       latest_blockhash: BlockHash::from_str(self.0["bestblockhash"].as_str().unwrap())
                                .unwrap(),
                        chain: self.0["chain"].as_str().unwrap().to_string(),
                })
@@ -141,7 +140,9 @@ impl TryInto<ListUnspentResponse> for JsonResponse {
                                amount: bitcoin::Amount::from_btc(utxo["amount"].as_f64().unwrap())
                                        .unwrap()
                                        .to_sat(),
-                               address: Address::from_str(&utxo["address"].as_str().unwrap().to_string()).unwrap(),
+                               address: Address::from_str(&utxo["address"].as_str().unwrap().to_string())
+                                       .unwrap()
+                                       .assume_checked(), // the expected network is not known at this point
                        })
                        .collect();
                Ok(ListUnspentResponse(utxos))
index d301180d605202690aa24dd96bbf1bfa2c18d7c2..9b9a72b229a90dbd2c4fed34a906537470ff7218 100644 (file)
@@ -27,7 +27,7 @@ impl FilesystemLogger {
        }
 }
 impl Logger for FilesystemLogger {
-       fn log(&self, record: &Record) {
+       fn log(&self, record: Record) {
                let raw_log = record.args.to_string();
                let log = format!(
                        "{} {:<5} [{}:{}] {}\n",
index 4c57c168e474fa238e9cd8eb4c9636cba41c07b2..73a6ddf3356e7d2aabfa9c32ea9debfbef379250 100644 (file)
@@ -25,7 +25,7 @@ use lightning::ln::channelmanager::{
 use lightning::ln::msgs::DecodeError;
 use lightning::ln::peer_handler::{IgnoringMessageHandler, MessageHandler, SimpleArcPeerManager};
 use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret};
-use lightning::onion_message::{DefaultMessageRouter, SimpleArcOnionMessenger};
+use lightning::onion_message::messenger::{DefaultMessageRouter, SimpleArcOnionMessenger};
 use lightning::routing::gossip;
 use lightning::routing::gossip::{NodeId, P2PGossipSync};
 use lightning::routing::router::DefaultRouter;
@@ -145,11 +145,6 @@ pub(crate) type GossipVerifier = lightning_block_sync::gossip::GossipVerifier<
        lightning_block_sync::gossip::TokioSpawner,
        Arc<lightning_block_sync::rpc::RpcClient>,
        Arc<FilesystemLogger>,
-       SocketDescriptor,
-       Arc<ChannelManager>,
-       Arc<OnionMessenger>,
-       IgnoringMessageHandler,
-       Arc<KeysManager>,
 >;
 
 pub(crate) type PeerManager = SimpleArcPeerManager<
@@ -195,12 +190,12 @@ async fn handle_ldk_events(
                        // Construct the raw transaction with one output, that is paid the amount of the
                        // channel.
                        let addr = WitnessProgram::from_scriptpubkey(
-                               &output_script[..],
+                               &output_script.as_bytes(),
                                match network {
                                        Network::Bitcoin => bitcoin_bech32::constants::Network::Bitcoin,
-                                       Network::Testnet => bitcoin_bech32::constants::Network::Testnet,
                                        Network::Regtest => bitcoin_bech32::constants::Network::Regtest,
                                        Network::Signet => bitcoin_bech32::constants::Network::Signet,
+                                       Network::Testnet | _ => bitcoin_bech32::constants::Network::Testnet,
                                },
                        )
                        .expect("Lightning funding tx should always be to a SegWit output")
@@ -500,6 +495,7 @@ async fn handle_ldk_events(
                        user_channel_id: _,
                        counterparty_node_id,
                        channel_capacity_sats: _,
+                       channel_funding_txo: _,
                } => {
                        println!(
                                "\nEVENT: Channel {} with counterparty {} closed due to: {:?}",
@@ -516,6 +512,7 @@ async fn handle_ldk_events(
                }
                Event::HTLCIntercepted { .. } => {}
                Event::BumpTransaction(event) => bump_tx_event_handler.handle_event(&event),
+               Event::ConnectionNeeded { .. } => {}
        }
 }
 
@@ -539,6 +536,7 @@ async fn start_ldk() {
                args.bitcoind_rpc_port,
                args.bitcoind_rpc_username.clone(),
                args.bitcoind_rpc_password.clone(),
+               args.network,
                tokio::runtime::Handle::current(),
                Arc::clone(&logger),
        )
@@ -556,9 +554,9 @@ async fn start_ldk() {
        if bitcoind_chain
                != match args.network {
                        bitcoin::Network::Bitcoin => "main",
-                       bitcoin::Network::Testnet => "test",
                        bitcoin::Network::Regtest => "regtest",
                        bitcoin::Network::Signet => "signet",
+                       bitcoin::Network::Testnet | _ => "test",
                } {
                println!(
                        "Chain argument ({}) didn't match bitcoind chain ({})",
@@ -777,7 +775,7 @@ async fn start_ldk() {
                Arc::clone(&keys_manager),
                Arc::clone(&keys_manager),
                Arc::clone(&logger),
-               Arc::new(DefaultMessageRouter {}),
+               Arc::new(DefaultMessageRouter::new(Arc::clone(&network_graph))),
                Arc::clone(&channel_manager),
                IgnoringMessageHandler {},
        ));
@@ -939,6 +937,7 @@ async fn start_ldk() {
                        })
                },
                false,
+               || Some(SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap()),
        ));
 
        // Regularly reconnect to channel peers.
index 87577df752424d59041844ff8080b1c9e8311ec1..b4ee017914f57d7f1a90a44084bbb9f7a374213d 100644 (file)
@@ -12,8 +12,8 @@ use lightning::util::ser::{Readable, WithoutLength, Writeable};
 
 use lightning_persister::fs_store::FilesystemStore;
 
+use bitcoin::blockdata::locktime::absolute::LockTime;
 use bitcoin::secp256k1::Secp256k1;
-use bitcoin::{LockTime, PackedLockTime};
 use rand::{thread_rng, Rng};
 
 use crate::hex_utils;
@@ -126,8 +126,8 @@ pub(crate) async fn periodic_sweep(
                                        cur_height = cur_height.saturating_sub(thread_rng().gen_range(0, 100));
                                }
 
-                               let locktime: PackedLockTime =
-                                       LockTime::from_height(cur_height).map_or(PackedLockTime::ZERO, |l| l.into());
+                               let locktime =
+                                       LockTime::from_height(cur_height).map_or(LockTime::ZERO, |l| l.into());
 
                                if let Ok(spending_tx) = keys_manager.spend_spendable_outputs(
                                        output_descriptors,