diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b9e46ac..c5ba2dfe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,11 @@ jobs: strategy: matrix: platform: [ ubuntu-latest, macos-latest, windows-latest ] - toolchain: [ stable, 1.48.0 ] + toolchain: [ stable ] include: - toolchain: stable check-fmt: true exclude: - - platform: macos-latest - toolchain: 1.48.0 - platform: windows-latest toolchain: stable runs-on: ${{ matrix.platform }} diff --git a/Cargo.lock b/Cargo.lock index 889e13a4..52000ef7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,27 @@ # 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-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -17,6 +38,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" @@ -69,27 +105,30 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytes" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -99,108 +138,43 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", - "winapi", + "windows-targets 0.48.5", ] [[package]] name = "chunked_transfer" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" - -[[package]] -name = "codespan-reporting" -version = "0.11.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" [[package]] name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "cxx" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.86" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fuchsia-cprng" @@ -208,50 +182,52 @@ 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" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -266,13 +242,14 @@ dependencies = [ "bitcoin-bech32", "chrono", "libc", - "lightning", + "lightning 0.0.118", "lightning-background-processor", "lightning-block-sync", "lightning-invoice", "lightning-net-tokio", "lightning-persister", "lightning-rapid-gossip-sync", + "log", "rand", "serde_json", "tempfile", @@ -281,53 +258,60 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "lightning" -version = "0.0.118" +version = "0.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cec5fa9382154fe9671e8df93095b800c7d77abc66e2a5ef839d672521c5e" +checksum = "cb0cb32c79c42444453bfabed7bd4f4ef64dfdd2e35e191fa8f3b9099ad2a186" dependencies = [ "bitcoin", ] +[[package]] +name = "lightning" +version = "0.0.118" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +dependencies = [ + "bitcoin", + "musig2", +] + [[package]] name = "lightning-background-processor" version = "0.0.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783150db7ad7b822e8029eae749123a377ed728b513a1610c3d9d3b31252da3e" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" dependencies = [ "bitcoin", - "lightning", + "lightning 0.0.118", "lightning-rapid-gossip-sync", ] [[package]] name = "lightning-block-sync" version = "0.0.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7710047d038a03fce32ac72b00c6ad79438053d3e8520cc7be97019660a694" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" dependencies = [ "bitcoin", "chunked_transfer", - "lightning", + "lightning 0.0.118", "serde_json", "tokio", ] [[package]] name = "lightning-invoice" -version = "0.26.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c" +checksum = "6d2380d053673c467c5f0be992cd4685e40d141d075647d74b64aba1b9c0b1ae" dependencies = [ "bech32 0.9.1", "bitcoin", "bitcoin_hashes", - "lightning", + "lightning 0.0.117", "num-traits", "secp256k1", ] @@ -335,151 +319,132 @@ dependencies = [ [[package]] name = "lightning-net-tokio" version = "0.0.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ee02c5a817b46a5fd6de4b2e196b58ae0e6eca5f3b8a6f0b0cd67bd9485ecc" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" dependencies = [ "bitcoin", - "lightning", + "lightning 0.0.118", "tokio", ] [[package]] name = "lightning-persister" version = "0.0.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ec1734f931d819ab51b7000d792f69c7d0602eb75ddc59cb6ea22c8b0c3461" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" dependencies = [ "bitcoin", - "lightning", - "windows-sys", + "lightning 0.0.118", + "windows-sys 0.48.0", ] [[package]] name = "lightning-rapid-gossip-sync" version = "0.0.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac66654c7593a16277cd9f1b7a078729318cad5cee2fe8948a2df4f756decb73" +source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" dependencies = [ "bitcoin", - "lightning", -] - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", + "lightning 0.0.118", ] [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] -name = "mio" -version = "0.7.14" +name = "miniz_oxide" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", + "adler", ] [[package]] -name = "miow" -version = "0.3.7" +name = "mio" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ - "winapi", + "libc", + "wasi", + "windows-sys 0.48.0", ] [[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +name = "musig2" +version = "0.1.0" +source = "git+https://github.com/arik-so/rust-musig2?rev=27797d7#27797d78cf64e8974e38d7f31ebb11e455015a9e" dependencies = [ - "winapi", + "bitcoin", ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "num-traits" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", - "num-traits", ] [[package]] -name = "num-traits" -version = "0.2.15" +name = "num_cpus" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "autocfg", + "hermit-abi", + "libc", ] [[package]] -name = "num_cpus" -version = "1.15.0" +name = "object" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ - "hermit-abi", - "libc", + "memchr", ] [[package]] name = "once_cell" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[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.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -523,43 +488,43 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "scratch" -version = "1.0.3" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "secp256k1" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "bitcoin_hashes", "secp256k1-sys", @@ -576,26 +541,50 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "syn" -version = "1.0.107" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -604,48 +593,39 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", + "windows-sys 0.48.0", ] [[package]] name = "tokio" -version = "1.14.1" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d0183f6f6001549ab68f8c7585093bb732beefbcf6d23a10b9b95c73a1dd49" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", "pin-project-lite", + "socket2", "tokio-macros", - "winapi", + "windows-sys 0.48.0", ] [[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", @@ -654,21 +634,21 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "unicode-width" -version = "0.1.10" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -676,9 +656,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -691,9 +671,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -701,9 +681,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -714,9 +694,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "winapi" @@ -734,28 +714,37 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] 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-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -764,13 +753,28 @@ 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", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -779,38 +783,80 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[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_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[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_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[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_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/Cargo.toml b/Cargo.toml index 806f5211..854ae290 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,19 +8,20 @@ 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 = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom", features = ["max_level_trace"] } +lightning-block-sync = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom", features = [ "rpc-client", "tokio" ] } +lightning-invoice = { version = "0.25.0" } +lightning-net-tokio = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom" } +lightning-persister = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom" } +lightning-background-processor = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom", features = [ "futures" ] } +lightning-rapid-gossip-sync = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom" } base64 = "0.13.0" bitcoin = "0.29.0" bitcoin-bech32 = "0.12" bech32 = "0.8" libc = "0.2" +log = "0.4.17" tempfile = "3.5.0" chrono = { version = "0.4", default-features = false, features = ["clock"] } diff --git a/rustfmt.toml b/rustfmt.toml index c00f6554..34eece02 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -2,4 +2,4 @@ hard_tabs = true # use tab characters for indentation, spaces for alignment use_field_init_shorthand = true max_width = 100 use_small_heuristics = "Max" -fn_args_layout = "Compressed" +fn_params_layout = "Compressed" diff --git a/src/config.rs b/src/config.rs index 75bbe9f2..f80694c7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,6 @@ use bitcoin::network::constants::Network; use lightning::ln::msgs::SocketAddress; +use lightning::util::logger::Level; use std::fs; use std::path::PathBuf; use tempfile::{Builder, TempDir}; @@ -14,6 +15,8 @@ pub struct LdkUserInfo { pub ldk_announced_listen_addr: Vec, pub ldk_announced_node_name: [u8; 32], pub network: Network, + pub log_level: Level, + pub node_num: u8, } // Here we initialize three layers of directories needed for our tests. We won't persist ldk data, but we'll persist diff --git a/src/disk.rs b/src/disk.rs index 0f85e55b..c10824e7 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -3,7 +3,7 @@ use bitcoin::secp256k1::PublicKey; use bitcoin::Network; use chrono::Utc; use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringDecayParameters}; -use lightning::util::logger::{Logger, Record}; +use lightning::util::logger::{Level, Logger, Record}; use lightning::util::ser::{Readable, ReadableArgs, Writer}; use std::collections::HashMap; use std::fs; @@ -18,15 +18,21 @@ pub(crate) const OUTBOUND_PAYMENTS_FNAME: &str = "outbound_payments"; pub(crate) struct FilesystemLogger { logs_dir: String, + level: Level, + // Specifies which ldk node this is in the integration tests. + node_num: u8, } impl FilesystemLogger { - pub(crate) fn new(logs_dir: String) -> Self { + pub(crate) fn new(logs_dir: String, level: Level, node_num: u8) -> Self { fs::create_dir_all(logs_dir.clone()).unwrap(); - Self { logs_dir } + Self { logs_dir, level, node_num } } } impl Logger for FilesystemLogger { fn log(&self, record: &Record) { + if record.level < self.level { + return; + } let raw_log = record.args.to_string(); let log = format!( "{} {:<5} [{}:{}] {}\n", @@ -39,7 +45,7 @@ impl Logger for FilesystemLogger { record.line, raw_log ); - let logs_file_path = format!("{}/logs.txt", self.logs_dir.clone()); + let logs_file_path = format!("{}/logs-ldk{}.txt", self.logs_dir.clone(), self.node_num); fs::OpenOptions::new() .create(true) .append(true) diff --git a/src/lib.rs b/src/lib.rs index 9725ac3b..c47d0f91 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,7 @@ use lightning::ln::channelmanager::{ use lightning::ln::msgs::DecodeError; use lightning::ln::peer_handler::{IgnoringMessageHandler, MessageHandler, PeerManager}; use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; +use lightning::log_info; use lightning::onion_message::{DefaultMessageRouter, OnionMessenger}; use lightning::routing::gossip; use lightning::routing::gossip::{NodeId, P2PGossipSync}; @@ -37,6 +38,7 @@ use lightning::routing::router::DefaultRouter; use lightning::routing::scoring::ProbabilisticScoringFeeParameters; use lightning::sign::{EntropySource, InMemorySigner, KeysManager, SpendableOutputDescriptor}; use lightning::util::config::UserConfig; +use lightning::util::logger::Logger; use lightning::util::persist::{KVStore, MonitorUpdatingPersister}; use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer}; use lightning::{chain, impl_writeable_tlv_based, impl_writeable_tlv_based_enum}; @@ -158,9 +160,9 @@ pub(crate) type GossipVerifier = lightning_block_sync::gossip::GossipVerifier< >; pub(crate) type P2PGossipSyncType = lightning::routing::gossip::P2PGossipSync< - Arc, - GossipVerifier, // Arc, - Arc, + Arc, + GossipVerifier, + Arc, >; pub(crate) type PeerManagerType = PeerManager< @@ -178,7 +180,7 @@ pub(crate) type ChannelManager = pub(crate) type NetworkGraph = gossip::NetworkGraph>; -// Reminder: We define the OnionMessenger as such because we need to use the OnionMessageHandler. +// Reminder: We define the OnionMessenger as such because we need to use the OnionMessageHandler. // This deviates from the main ldk-sample fork. // This also impacts the PeerManager and GossipVerifier type definitions above. pub(crate) type OnionMessengerType = OnionMessenger< @@ -548,7 +550,9 @@ pub async fn start_ldk(args: config::LdkUserInfo, test_name: &str) -> node_api:: // ## Setup // Step 1: Initialize the Logger - let logger = Arc::new(FilesystemLogger::new(ldk_log_dir.clone())); + let logger = + Arc::new(FilesystemLogger::new(ldk_log_dir.clone(), args.log_level, args.node_num)); + log_info!(logger, "LDK node is starting up."); // Initialize our bitcoind client. let bitcoind_client = match BitcoindClient::new( @@ -786,8 +790,10 @@ pub async fn start_ldk(args: config::LdkUserInfo, test_name: &str) -> node_api:: Arc::new(P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger))); // Step 15: Initialize the PeerManager - let onion_message_handler = - Arc::new(OnionMessageHandler { messages: Arc::new(Mutex::new(VecDeque::new())) }); + let onion_message_handler = Arc::new(OnionMessageHandler { + messages: Arc::new(Mutex::new(VecDeque::new())), + logger: Arc::clone(&logger), + }); let channel_manager: Arc = Arc::new(channel_manager); let onion_messenger: Arc = Arc::new(OnionMessenger::new( Arc::clone(&keys_manager), diff --git a/src/node_api.rs b/src/node_api.rs index 253fc55c..a8e8e581 100644 --- a/src/node_api.rs +++ b/src/node_api.rs @@ -1,10 +1,15 @@ use crate::disk::FilesystemLogger; use crate::onion::{OnionMessageHandler, UserOnionMessageContents}; use crate::{ - BitcoindClient, ChainMonitor, ChannelManager, NetworkGraph, OnionMessengerType, PeerManagerType, P2PGossipSyncType, + BitcoindClient, ChainMonitor, ChannelManager, NetworkGraph, OnionMessengerType, + P2PGossipSyncType, PeerManagerType, }; -use bitcoin::secp256k1::PublicKey; +use bitcoin::secp256k1::{PublicKey, Secp256k1}; +use bitcoin::Network; +use lightning::blinded_path::BlindedPath; +use lightning::offers::offer::{Offer, OfferBuilder, Quantity}; +use lightning::offers::parse::Bolt12SemanticError; use lightning::onion_message::{Destination, OnionMessagePath}; use lightning::routing::router::DefaultRouter; use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters}; @@ -13,7 +18,7 @@ use lightning_persister::fs_store::FilesystemStore; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, RwLock}; -use std::time::Duration; +use std::time::{Duration, SystemTime}; use tempfile::TempDir; use tokio::sync::watch::Sender; @@ -139,6 +144,27 @@ impl Node { } } + // Build an offer for receiving payments at this node. path_pubkeys lists the nodes the path will contain, + // starting with the introduction node and ending in the destination node (the current node). + pub async fn create_offer( + &self, path_pubkeys: &[PublicKey], network: Network, msats: u64, quantity: Quantity, + expiration: SystemTime, + ) -> Result { + let secp_ctx = Secp256k1::new(); + let path = + BlindedPath::new_for_message(path_pubkeys, &*self.keys_manager, &secp_ctx).unwrap(); + let (pubkey, _) = self.get_node_info(); + + OfferBuilder::new("testing offer".to_string(), pubkey) + .amount_msats(msats) + .chain(network) + .supported_quantity(quantity) + .absolute_expiry(expiration.duration_since(SystemTime::UNIX_EPOCH).unwrap()) + .issuer("Foo Bar".to_string()) + .path(path) + .build() + } + pub async fn stop(self) { // Disconnect our peers and stop accepting new connections. This ensures we don't continue // updating our channel data after we've stopped the background processor. diff --git a/src/onion.rs b/src/onion.rs index ecaf135a..7edbcf04 100644 --- a/src/onion.rs +++ b/src/onion.rs @@ -1,6 +1,11 @@ +use crate::disk::FilesystemLogger; use lightning::io::Read; use lightning::ln::msgs::DecodeError; -use lightning::onion_message::{CustomOnionMessageHandler, OnionMessageContents, PendingOnionMessage}; +use lightning::log_info; +use lightning::onion_message::{ + CustomOnionMessageHandler, OnionMessageContents, PendingOnionMessage, +}; +use lightning::util::logger::Logger; use lightning::util::ser::{Writeable, Writer}; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; @@ -27,13 +32,14 @@ impl Writeable for UserOnionMessageContents { #[derive(Clone)] pub struct OnionMessageHandler { pub messages: Arc>>, + pub(crate) logger: Arc, } impl CustomOnionMessageHandler for OnionMessageHandler { type CustomMessage = UserOnionMessageContents; fn handle_custom_message(&self, msg: Self::CustomMessage) -> Option { - println!("Received a new custom message!"); + log_info!(self.logger, "Received a new custom message!"); self.messages.lock().unwrap().push_back(msg.clone()); Some(msg) } @@ -46,7 +52,7 @@ impl CustomOnionMessageHandler for OnionMessageHandler { Ok(Some(UserOnionMessageContents { tlv_type: message_type, data: buf.to_vec() })) } - fn release_pending_custom_messages(&self) -> Vec> { + fn release_pending_custom_messages(&self) -> Vec> { vec![] - } + } }