Merge pull request #1223 from lightning-signer/2021-12-invoice-nostd
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Thu, 6 Jan 2022 19:25:36 +0000 (19:25 +0000)
committerGitHub <noreply@github.com>
Thu, 6 Jan 2022 19:25:36 +0000 (19:25 +0000)
Adapt lightning-invoice to no_std

.github/workflows/build.yml
CONTRIBUTING.md
lightning-background-processor/Cargo.toml
lightning-block-sync/Cargo.toml
lightning-net-tokio/Cargo.toml
lightning-persister/Cargo.toml
lightning/Cargo.toml
lightning/src/ln/channelmanager.rs
lightning/src/routing/network_graph.rs
lightning/src/util/logger.rs

index 5dcbb677e6d8a6d6f88e62b20e7307c862807c0e..002005f1809ef32adbb464a9a5491383512a0dbd 100644 (file)
@@ -109,11 +109,14 @@ jobs:
         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
       - name: Test on no-std bullds Rust ${{ matrix.toolchain }}
         if: "matrix.build-no-std && !matrix.coverage"
+        shell: bash # Default on Winblows is powershell
         run: |
           cd lightning
           cargo test --verbose --color always --no-default-features --features no-std
           # check if there is a conflict between no-std and the default std feature
           cargo test --verbose --color always --features no-std
+          # check if there is a conflict between no-std and the c_bindings cfg
+          RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
           cd ..
           cd lightning-invoice
           cargo test --verbose --color always --no-default-features --features no-std
@@ -245,7 +248,7 @@ jobs:
           profile: minimal
       - name: Fetch full tree and rebase on upstream
         run: |
-          git remote add upstream https://github.com/rust-bitcoin/rust-lightning
+          git remote add upstream https://github.com/lightningdevkit/rust-lightning
           git fetch upstream
           export GIT_COMMITTER_EMAIL="rl-ci@example.com"
           export GIT_COMMITTER_NAME="RL CI"
index 3cf463ba02e220b7f1e12605398c344fc3d79628..2c1fb0d8a7376db6a0b7624fa8d0c0583423c64c 100644 (file)
@@ -21,8 +21,8 @@ Communication about Rust-Lightning happens primarily on #ldk-dev on the
 Discussion about code base improvements happens in GitHub issues and on pull
 requests.
 
-Major projects are tracked [here](https://github.com/rust-bitcoin/rust-lightning/projects).
-Major milestones are tracked [here](https://github.com/rust-bitcoin/rust-lightning/milestones?direction=asc&sort=title&state=open).
+Major projects are tracked [here](https://github.com/lightningdevkit/rust-lightning/projects).
+Major milestones are tracked [here](https://github.com/lightningdevkit/rust-lightning/milestones?direction=asc&sort=title&state=open).
 
 Getting Started
 ---------------
@@ -33,7 +33,7 @@ This doesn't mean don't be ambitious with the breadth and depth of your contribu
 understand the project culture before investing an asymmetric number of hours on
 development compared to your merged work.
 
-Browsing through the [meeting minutes](https://github.com/rust-bitcoin/rust-lightning/wiki/Meetings)
+Browsing through the [meeting minutes](https://github.com/lightningdevkit/rust-lightning/wiki/Meetings)
 is a good first step. You will learn who is working on what, how releases are drafted, what are the
 pending tasks to deliver, where you can contribute review bandwidth, etc.
 
index 0056393dd2557111a31482bb7b49d1473794eac2..1837cb17e664839de009f2c01ba2a2ac3055d6dd 100644 (file)
@@ -3,7 +3,7 @@ name = "lightning-background-processor"
 version = "0.0.104"
 authors = ["Valentine Wallace <vwallace@protonmail.com>"]
 license = "MIT OR Apache-2.0"
-repository = "http://github.com/rust-bitcoin/rust-lightning"
+repository = "http://github.com/lightningdevkit/rust-lightning"
 description = """
 Utilities to perform required background tasks for Rust Lightning.
 """
index ae6eb58258d4e2f49433b6988dbf9c391fdd962c..d12428409f7676ce18a0dc549b75cbf945e40c62 100644 (file)
@@ -3,7 +3,7 @@ name = "lightning-block-sync"
 version = "0.0.104"
 authors = ["Jeffrey Czyz", "Matt Corallo"]
 license = "MIT OR Apache-2.0"
-repository = "http://github.com/rust-bitcoin/rust-lightning"
+repository = "http://github.com/lightningdevkit/rust-lightning"
 description = """
 Utilities to fetch the chain data from a block source and feed them into Rust Lightning.
 """
index 0a763f09fefcdc964242f3195632f9e765fae861..185e5d128d5e0e0a2fdc853bf7cc939f1412f90d 100644 (file)
@@ -3,7 +3,7 @@ name = "lightning-net-tokio"
 version = "0.0.104"
 authors = ["Matt Corallo"]
 license = "MIT OR Apache-2.0"
-repository = "https://github.com/rust-bitcoin/rust-lightning/"
+repository = "https://github.com/lightningdevkit/rust-lightning/"
 description = """
 Implementation of the rust-lightning network stack using Tokio.
 For Rust-Lightning clients which wish to make direct connections to Lightning P2P nodes, this is a simple alternative to implementing the required network stack, especially for those already using Tokio.
index 7c32b6cf4a1aa4cca19dba38295f3185342a025c..27f772cf326e84574bfd2cbfd70c6c9360d84ccf 100644 (file)
@@ -3,7 +3,7 @@ name = "lightning-persister"
 version = "0.0.104"
 authors = ["Valentine Wallace", "Matt Corallo"]
 license = "MIT OR Apache-2.0"
-repository = "https://github.com/rust-bitcoin/rust-lightning/"
+repository = "https://github.com/lightningdevkit/rust-lightning/"
 description = """
 Utilities to manage Rust-Lightning channel data persistence and retrieval.
 """
index 1234cd5c05c0fd34668be44e6bdef43823f11a5a..445e92234439ecee2324d8c8e190f2bae59607db 100644 (file)
@@ -3,7 +3,7 @@ name = "lightning"
 version = "0.0.104"
 authors = ["Matt Corallo"]
 license = "MIT OR Apache-2.0"
-repository = "https://github.com/rust-bitcoin/rust-lightning/"
+repository = "https://github.com/lightningdevkit/rust-lightning/"
 description = """
 A Bitcoin Lightning library in Rust.
 Does most of the hard work, without implying a specific runtime, requiring clients implement basic network logic, chain interactions and disk storage.
index c51d17f67b9df16701321b687e23d533e191cd68..95f1e86b9c3ad8e67c8c3b2d0ad6e4bc6e22120b 100644 (file)
@@ -6372,7 +6372,7 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
                                        log_error!(args.logger, " The chain::Watch API *requires* that monitors are persisted durably before returning,");
                                        log_error!(args.logger, " client applications must ensure that ChannelMonitor data is always available and the latest to avoid funds loss!");
                                        log_error!(args.logger, " Without the latest ChannelMonitor we cannot continue without risking funds.");
-                                       log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/rust-bitcoin/rust-lightning");
+                                       log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/lightningdevkit/rust-lightning");
                                        return Err(DecodeError::InvalidValue);
                                } else if channel.get_cur_holder_commitment_transaction_number() > monitor.get_cur_holder_commitment_number() ||
                                                channel.get_revoked_counterparty_commitment_transaction_number() > monitor.get_min_seen_secret() ||
@@ -6403,7 +6403,7 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
                                log_error!(args.logger, " The chain::Watch API *requires* that monitors are persisted durably before returning,");
                                log_error!(args.logger, " client applications must ensure that ChannelMonitor data is always available and the latest to avoid funds loss!");
                                log_error!(args.logger, " Without the ChannelMonitor we cannot continue without risking funds.");
-                               log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/rust-bitcoin/rust-lightning");
+                               log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/lightningdevkit/rust-lightning");
                                return Err(DecodeError::InvalidValue);
                        }
                }
index ae597d30364f5ca039cac07c99d5d317179a750e..0b09b74aa9a484db8912587accd83e9f2ff7434a 100644 (file)
@@ -1170,10 +1170,10 @@ impl NetworkGraph {
                        // disable this check during tests!
                        let time = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time must be > 1970").as_secs();
                        if (msg.timestamp as u64) < time - STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS {
-                               return Err(LightningError{err: "channel_update is older than two weeks old".to_owned(), action: ErrorAction::IgnoreError});
+                               return Err(LightningError{err: "channel_update is older than two weeks old".to_owned(), action: ErrorAction::IgnoreAndLog(Level::Gossip)});
                        }
                        if msg.timestamp as u64 > time + 60 * 60 * 24 {
-                               return Err(LightningError{err: "channel_update has a timestamp more than a day in the future".to_owned(), action: ErrorAction::IgnoreError});
+                               return Err(LightningError{err: "channel_update has a timestamp more than a day in the future".to_owned(), action: ErrorAction::IgnoreAndLog(Level::Gossip)});
                        }
                }
 
index f8fc1eda1080e6bf3ad3aed723ac553d6bf5daa3..ff576e26ddf4ca485d648c943ad3f36384b30653 100644 (file)
@@ -17,6 +17,9 @@
 use core::cmp;
 use core::fmt;
 
+#[cfg(c_bindings)]
+use prelude::*; // Needed for String
+
 static LOG_LEVEL_NAMES: [&'static str; 6] = ["GOSSIP", "TRACE", "DEBUG", "INFO", "WARN", "ERROR"];
 
 /// An enum representing the available verbosity levels of the logger.