diff --git a/src/commands.rs b/src/commands.rs index cc53e6f..ecb4db7 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -648,6 +648,7 @@ fn show_transaction(out: &mut dyn Write, n: Network, tx: Transaction) -> Result< for i in &tx.inputs { let who = match (i.address.as_deref(), i.mweb.as_deref(), &i.previous_output) { (Some(a), _, _) => a, + (None, Some("pegin"), _) => "MWEB peg-in", (None, Some(_), _) => "MWEB pool", (None, None, None) => "newly mined coins", // Pay-to-public-key, bare multisig and other scripts without one. diff --git a/src/model.rs b/src/model.rs index bc2cca4..5305d51 100644 --- a/src/model.rs +++ b/src/model.rs @@ -120,7 +120,8 @@ pub struct TxInput { /// Null for a coinbase input, which spends no earlier output. #[serde(default)] pub previous_output: Option, - /// Litecoin: `pool` or `pegin` when the input comes from the MWEB side. + /// Litecoin: `pool` when the input spends the MWEB pool, `pegin` when it + /// spends a peg-in. #[serde(default)] pub mweb: Option, } diff --git a/tests/cli.rs b/tests/cli.rs index 89af5f4..29c2443 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -936,6 +936,11 @@ fn inputs_without_an_address_are_told_apart() { json!({ "hash": TXID, "index": 1 }), Some("pool") ), + input( + Value::Null, + json!({ "hash": TXID, "index": 2 }), + Some("pegin") + ), ]); let m = mock(vec![ok(tx)]); sochain(&m, &config()) @@ -944,7 +949,8 @@ fn inputs_without_an_address_are_told_apart() { .success() .stdout(predicate::str::contains(" newly mined coins 1 LTC")) .stdout(predicate::str::contains(" (no address) 1 LTC")) - .stdout(predicate::str::contains(" MWEB pool 1 LTC")); + .stdout(predicate::str::contains(" MWEB pool 1 LTC")) + .stdout(predicate::str::contains(" MWEB peg-in 1 LTC")); } #[test]