mirror of
https://github.com/PR0M3TH3AN/Private-Proof-Of-Reserve-Cli.git
synced 2026-10-27 08:50:29 +00:00
Merge branch 'main' of https://github.com/PR0M3TH3AN/Private-Proof-Of-Reserve-Cli
This commit is contained in:
commit
e8afe8c302
3 files changed
+49
-1
No files matched your search
@@ -0,0 +1,18 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- name: Cargo test
|
||||
run: cargo test --locked --all
|
||||
@@ -31,7 +31,12 @@ cargo build --release
|
||||
sudo install -m755 target/release/private_proof_of_reserve_cli /usr/local/bin/por
|
||||
```
|
||||
|
||||
---
|
||||
## Running tests
|
||||
|
||||
```bash
|
||||
cargo test
|
||||
```
|
||||
|
||||
|
||||
\## Running a local Bitcoin node
|
||||
|
||||
|
||||
+25
@@ -1,3 +1,4 @@
|
||||
#![forbid(unsafe_code)]
|
||||
//! Prototype CLI for a lower-bound Bitcoin proof-of-reserve.
|
||||
//! SECURITY: demo code only.
|
||||
|
||||
@@ -158,3 +159,27 @@ fn verify_proof(pf: &Proof, rpc_url: &str, rpc_user: &str, rpc_pass: &str) -> Re
|
||||
let _ = RangeProof::from_bytes(&base64::decode(&pf.range_proof)?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ── tests ───────────────────────────────────────────────────
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn merkle_root_single_leaf() {
|
||||
let leaf = [42u8; 32];
|
||||
assert_eq!(merkle_root(vec![leaf]), leaf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merkle_root_two_leaves() {
|
||||
let a = [1u8; 32];
|
||||
let b = [2u8; 32];
|
||||
let mut h = Sha256::new();
|
||||
h.update(a);
|
||||
h.update(b);
|
||||
let expected: [u8; 32] = h.finalize().into();
|
||||
assert_eq!(merkle_root(vec![a, b]), expected);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user