X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-invoice%2Ftests%2Fser_de.rs;fp=lightning-invoice%2Ftests%2Fser_de.rs;h=c2f82b0990c9c99ea6c632dab2d000442db12b30;hb=0be428eeda30e449b251e74bc330342abe3ef0c5;hp=807308044d2e064125d7e0028560256a4031d5e3;hpb=181cb1103d0a1f21aa1f2e44e2f36a6c68663b2f;p=rust-lightning diff --git a/lightning-invoice/tests/ser_de.rs b/lightning-invoice/tests/ser_de.rs index 80730804..c2f82b09 100644 --- a/lightning-invoice/tests/ser_de.rs +++ b/lightning-invoice/tests/ser_de.rs @@ -49,7 +49,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawInvoice, Option)> { k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch\ 9zw97j25emudupq63nyw24cg27h2rspfj9srp".to_owned(), InvoiceBuilder::new(Currency::Bitcoin) - .amount_pico_btc(2500000000) + .amount_milli_satoshis(250_000_000) .timestamp(UNIX_EPOCH + Duration::from_secs(1496314658)) .payment_hash(sha256::Hash::from_hex( "0001020304050607080900010203040506070809000102030405060708090102" @@ -78,7 +78,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawInvoice, Option)> { dhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqscc6gd6ql3jrc5yzme8v4ntcewwz5cnw92tz0pc8qcuufvq7k\ hhr8wpald05e92xw006sq94mg8v2ndf4sefvf9sygkshp5zfem29trqq2yxxz7".to_owned(), InvoiceBuilder::new(Currency::Bitcoin) - .amount_pico_btc(20000000000) + .amount_milli_satoshis(2_000_000_000) .timestamp(UNIX_EPOCH + Duration::from_secs(1496314658)) .payment_hash(sha256::Hash::from_hex( "0001020304050607080900010203040506070809000102030405060708090102" @@ -110,7 +110,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawInvoice, Option)> { "0001020304050607080900010203040506070809000102030405060708090102" ).unwrap()) .description("coffee beans".to_string()) - .amount_pico_btc(20000000000) + .amount_milli_satoshis(2_000_000_000) .timestamp(UNIX_EPOCH + Duration::from_secs(1496314658)) .payment_secret(PaymentSecret([42; 32])) .build_raw() @@ -172,4 +172,7 @@ fn test_bolt_invalid_invoices() { assert_eq!(Invoice::from_str( "lnbc2500x1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpujr6jxr9gq9pv6g46y7d20jfkegkg4gljz2ea2a3m9lmvvr95tq2s0kvu70u3axgelz3kyvtp2ywwt0y8hkx2869zq5dll9nelr83zzqqpgl2zg" ), Err(ParseOrSemanticError::ParseError(ParseError::UnknownSiPrefix))); + assert_eq!(Invoice::from_str( + "lnbc2500000001p1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpu7hqtk93pkf7sw55rdv4k9z2vj050rxdr6za9ekfs3nlt5lr89jqpdmxsmlj9urqumg0h9wzpqecw7th56tdms40p2ny9q4ddvjsedzcplva53s" + ), Err(ParseOrSemanticError::SemanticError(SemanticError::ImpreciseAmount))); }