<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Descriptor checksum"><meta name="keywords" content="rust, rustlang, rust-lang, checksum"><title>bdk::descriptor::checksum - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module checksum</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">checksum</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/checksum.rs.html#12-180">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor checksum</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module checksum</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">checksum</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/checksum.rs.html#12-181">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor checksum</p>
<p>This module contains a re-implementation of the function used by Bitcoin Core to calculate the
checksum of a descriptor</p>
</div></details><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.calc_checksum.html" title="bdk::descriptor::checksum::calc_checksum fn">calc_checksum</a></div><div class="item-right docblock-short">Compute the checksum of a descriptor, excludes any existing checksum in the descriptor string from the calculation</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.calc_checksum_bytes.html" title="bdk::descriptor::checksum::calc_checksum_bytes fn">calc_checksum_bytes</a></div><div class="item-right docblock-short">Compute the checksum bytes of a descriptor, excludes any existing checksum in the descriptor string from the calculation</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.get_checksum.html" title="bdk::descriptor::checksum::get_checksum fn">get_checksum</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">Compute the checksum of a descriptor</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.get_checksum_bytes.html" title="bdk::descriptor::checksum::get_checksum_bytes fn">get_checksum_bytes</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">Compute the checksum bytes of a descriptor</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="bdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0-nightly (0f529f0f4 2022-12-13)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Descriptors"><meta name="keywords" content="rust, rustlang, rust-lang, descriptor"><title>bdk::descriptor - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module descriptor</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">bdk</a>::<wbr><a class="mod" href="#">descriptor</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/bdk/descriptor/mod.rs.html#12-888">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptors</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module descriptor</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">bdk</a>::<wbr><a class="mod" href="#">descriptor</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/bdk/descriptor/mod.rs.html#12-873">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptors</p>
<p>This module contains generic utilities to work with descriptors, plus some re-exported types
from [<code>miniscript</code>].</p>
</div></details><h2 id="reexports" class="small-section-header"><a href="#reexports">Re-exports</a></h2><div class="item-table"><div class="item-row"><div class="item-left import-item" id="reexport.calc_checksum"><code>pub use self::checksum::<a class="fn" href="checksum/fn.calc_checksum.html" title="fn bdk::descriptor::checksum::calc_checksum">calc_checksum</a>;</code></div></div><div class="item-row"><div class="item-left import-item" id="reexport.DescriptorError"><code>pub use self::error::<a class="enum" href="error/enum.Error.html" title="enum bdk::descriptor::error::Error">Error</a> as DescriptorError;</code></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Policy"><code>pub use self::policy::<a class="struct" href="policy/struct.Policy.html" title="struct bdk::descriptor::policy::Policy">Policy</a>;</code></div></div></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="checksum/index.html" title="bdk::descriptor::checksum mod">checksum</a></div><div class="item-right docblock-short">Descriptor checksum</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="error/index.html" title="bdk::descriptor::error mod">error</a></div><div class="item-right docblock-short">Descriptor errors</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="policy/index.html" title="bdk::descriptor::policy mod">policy</a></div><div class="item-right docblock-short">Descriptor policy</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="template/index.html" title="bdk::descriptor::template mod">template</a></div><div class="item-right docblock-short">Descriptor templates</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DescriptorXKey.html" title="bdk::descriptor::DescriptorXKey struct">DescriptorXKey</a></div><div class="item-right docblock-short">An extended key with origin, derivation path, and wildcard.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Miniscript.html" title="bdk::descriptor::Miniscript struct">Miniscript</a></div><div class="item-right docblock-short">Top-level script AST type</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Descriptor.html" title="bdk::descriptor::Descriptor enum">Descriptor</a></div><div class="item-right docblock-short">Script descriptor</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.DescriptorPublicKey.html" title="bdk::descriptor::DescriptorPublicKey enum">DescriptorPublicKey</a></div><div class="item-right docblock-short">The descriptor pubkey, either a single pubkey or an xpub.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Legacy.html" title="bdk::descriptor::Legacy enum">Legacy</a></div><div class="item-right docblock-short">Legacy ScriptContext
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Descriptor policy"><meta name="keywords" content="rust, rustlang, rust-lang, policy"><title>bdk::descriptor::policy - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module policy</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">policy</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/policy.rs.html#12-1922">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor policy</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module policy</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">policy</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/policy.rs.html#12-1876">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor policy</p>
<p>This module implements the logic to extract and represent the spending policies of a descriptor
in a more human-readable format.</p>
<p>This is an <strong>EXPERIMENTAL</strong> feature, API and other major changes are expected.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Descriptor templates"><meta name="keywords" content="rust, rustlang, rust-lang, template"><title>bdk::descriptor::template - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module template</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">template</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/template.rs.html#12-779">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor templates</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module template</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">descriptor</a>::<wbr><a class="mod" href="#">template</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/descriptor/template.rs.html#12-780">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Descriptor templates</p>
<p>This module contains the definition of various common script templates that are ready to be
used. See the documentation of each template for an example.</p>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip44.html" title="bdk::descriptor::template::Bip44 struct">Bip44</a></div><div class="item-right docblock-short">BIP44 template. Expands to <code>pkh(key/44'/{0,1}'/0'/{0,1}/*)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip44Public.html" title="bdk::descriptor::template::Bip44Public struct">Bip44Public</a></div><div class="item-right docblock-short">BIP44 public template. Expands to <code>pkh(key/{0,1}/*)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip49.html" title="bdk::descriptor::template::Bip49 struct">Bip49</a></div><div class="item-right docblock-short">BIP49 template. Expands to <code>sh(wpkh(key/49'/{0,1}'/0'/{0,1}/*))</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip49Public.html" title="bdk::descriptor::template::Bip49Public struct">Bip49Public</a></div><div class="item-right docblock-short">BIP49 public template. Expands to <code>sh(wpkh(key/{0,1}/*))</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip84.html" title="bdk::descriptor::template::Bip84 struct">Bip84</a></div><div class="item-right docblock-short">BIP84 template. Expands to <code>wpkh(key/84'/{0,1}'/0'/{0,1}/*)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bip84Public.html" title="bdk::descriptor::template::Bip84Public struct">Bip84Public</a></div><div class="item-right docblock-short">BIP84 public template. Expands to <code>wpkh(key/{0,1}/*)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.P2Pkh.html" title="bdk::descriptor::template::P2Pkh struct">P2Pkh</a></div><div class="item-right docblock-short">P2PKH template. Expands to a descriptor <code>pkh(key)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.P2Wpkh.html" title="bdk::descriptor::template::P2Wpkh struct">P2Wpkh</a></div><div class="item-right docblock-short">P2WPKH template. Expands to a descriptor <code>wpkh(key)</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.P2Wpkh_P2Sh.html" title="bdk::descriptor::template::P2Wpkh_P2Sh struct">P2Wpkh_P2Sh</a></div><div class="item-right docblock-short">P2WPKH-P2SH template. Expands to a descriptor <code>sh(wpkh(key))</code></div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.DescriptorTemplate.html" title="bdk::descriptor::template::DescriptorTemplate trait">DescriptorTemplate</a></div><div class="item-right docblock-short">Trait for descriptor templates that can be built into a full descriptor</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.DescriptorTemplateOut.html" title="bdk::descriptor::template::DescriptorTemplateOut type">DescriptorTemplateOut</a></div><div class="item-right docblock-short">Type alias for the return type of <a href="trait.DescriptorTemplate.html" title="DescriptorTemplate"><code>DescriptorTemplate</code></a>, <a href="../../macro.descriptor.html"><code>descriptor!</code></a> and others</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="bdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0-nightly (0f529f0f4 2022-12-13)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Get the version of BDK at runtime"><meta name="keywords" content="rust, rustlang, rust-lang, version"><title>version in bdk - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><div class="sidebar-elems"><h2><a href="index.html">In bdk</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Function <a href="index.html">bdk</a>::<wbr><a class="fn" href="#">version</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bdk/lib.rs.html#283-285">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust fn"><code>pub fn version() -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Get the version of BDK at runtime</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><div class="sidebar-elems"><h2><a href="index.html">In bdk</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Function <a href="index.html">bdk</a>::<wbr><a class="fn" href="#">version</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bdk/lib.rs.html#286-288">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust fn"><code>pub fn version() -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Get the version of BDK at runtime</p>
</div></details></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0-nightly (0f529f0f4 2022-12-13)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A modern, lightweight, descriptor-based wallet library written in Rust."><meta name="keywords" content="rust, rustlang, rust-lang, bdk"><title>bdk - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Crate bdk</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.25.0</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">bdk</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bdk/lib.rs.html#13-285">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A modern, lightweight, descriptor-based wallet library written in Rust.</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Crate bdk</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.25.0</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">bdk</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bdk/lib.rs.html#13-288">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A modern, lightweight, descriptor-based wallet library written in Rust.</p>
<h2 id="about"><a href="#about">About</a></h2>
<p>The BDK library aims to be the core building block for Bitcoin wallets of any kind.</p>
<ul>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Coin selection"><meta name="keywords" content="rust, rustlang, rust-lang, coin_selection"><title>bdk::wallet::coin_selection - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module coin_selection</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">coin_selection</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/coin_selection.rs.html#12-1600">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Coin selection</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module coin_selection</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">coin_selection</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/coin_selection.rs.html#12-1595">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Coin selection</p>
<p>This module provides the trait <a href="trait.CoinSelectionAlgorithm.html" title="CoinSelectionAlgorithm"><code>CoinSelectionAlgorithm</code></a> that can be implemented to
define custom coin selection algorithms.</p>
<p>You can specify a custom coin selection algorithm through the <a href="../tx_builder/struct.TxBuilder.html#method.coin_selection"><code>coin_selection</code></a> method on
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Wallet"><meta name="keywords" content="rust, rustlang, rust-lang, wallet"><title>bdk::wallet - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module wallet</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">bdk</a>::<wbr><a class="mod" href="#">wallet</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/bdk/wallet/mod.rs.html#12-5588">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Wallet</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module wallet</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">bdk</a>::<wbr><a class="mod" href="#">wallet</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/bdk/wallet/mod.rs.html#12-5574">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Wallet</p>
<p>This module defines the <a href="struct.Wallet.html" title="Wallet"><code>Wallet</code></a> structure.</p>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="coin_selection/index.html" title="bdk::wallet::coin_selection mod">coin_selection</a></div><div class="item-right docblock-short">Coin selection</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="export/index.html" title="bdk::wallet::export mod">export</a></div><div class="item-right docblock-short">Wallet export</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="hardwaresigner/index.html" title="bdk::wallet::hardwaresigner mod">hardwaresigner</a><span class="stab portability" title="Available on crate feature `hardware-signer` only"><code>hardware-signer</code></span></div><div class="item-right docblock-short">HWI Signer</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="signer/index.html" title="bdk::wallet::signer mod">signer</a></div><div class="item-right docblock-short">Generalized signers</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="time/index.html" title="bdk::wallet::time mod">time</a></div><div class="item-right docblock-short">Cross-platform time</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="tx_builder/index.html" title="bdk::wallet::tx_builder mod">tx_builder</a></div><div class="item-right docblock-short">Transaction builder</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="verify/index.html" title="bdk::wallet::verify mod">verify</a><span class="stab portability" title="Available on crate feature `verify` only"><code>verify</code></span></div><div class="item-right docblock-short">Verify transactions against the consensus rules</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.AddressInfo.html" title="bdk::wallet::AddressInfo struct">AddressInfo</a></div><div class="item-right docblock-short">A derived address and the index it was found at
For convenience this automatically derefs to <code>Address</code></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SyncOptions.html" title="bdk::wallet::SyncOptions struct">SyncOptions</a></div><div class="item-right docblock-short">Options to a <a href="struct.Wallet.html#method.sync"><code>sync</code></a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Wallet.html" title="bdk::wallet::Wallet struct">Wallet</a></div><div class="item-right docblock-short">A Bitcoin wallet</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AddressIndex.html" title="bdk::wallet::AddressIndex enum">AddressIndex</a></div><div class="item-right docblock-short">The address index selection strategy to use to derived an address from the wallet’s external
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Generalized signers"><meta name="keywords" content="rust, rustlang, rust-lang, signer"><title>bdk::wallet::signer - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module signer</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">signer</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/signer.rs.html#12-1123">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Generalized signers</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module signer</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">signer</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/signer.rs.html#12-1124">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Generalized signers</p>
<p>This module provides the ability to add customized signers to a <a href="../struct.Wallet.html"><code>Wallet</code></a>
through the <a href="../struct.Wallet.html#method.add_signer"><code>Wallet::add_signer</code></a> function.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Verify transactions against the consensus rules"><meta name="keywords" content="rust, rustlang, rust-lang, verify"><title>bdk::wallet::verify - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-64f7dca12162a801.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../../../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../../../static.files/ayu-94f39d4346842c1e.css"><script id="default-settings" ></script><script src="../../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../../static.files/main-a211dbb005fb8161.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../bdk/index.html"><div class="logo-container">
- <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module verify</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">verify</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/verify.rs.html#12-162">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>verify</code></strong> only.</div></span><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Verify transactions against the consensus rules</p>
+ <img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></div></a><h2 class="location"><a href="#">Module verify</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">bdk</a>::<wbr><a href="../index.html">wallet</a>::<wbr><a class="mod" href="#">verify</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/bdk/wallet/verify.rs.html#12-161">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>verify</code></strong> only.</div></span><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Verify transactions against the consensus rules</p>
</div></details><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.VerifyError.html" title="bdk::wallet::verify::VerifyError enum">VerifyError</a></div><div class="item-right docblock-short">Error during validation of a tx agains the consensus rules</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.verify_tx.html" title="bdk::wallet::verify::verify_tx fn">verify_tx</a></div><div class="item-right docblock-short">Verify a transaction against the consensus rules</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="bdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0-nightly (0f529f0f4 2022-12-13)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>
\ No newline at end of file
<span class="kw">let </span>resp = peer.get_cf_headers(<span class="number">0x00</span>, start_height <span class="kw">as </span>u32, stop_hash)<span class="question-mark">?</span>;
- <span class="macro">assert!</span>(resp.previous_filter_header == checkpoint);
+ <span class="macro">assert_eq!</span>(resp.previous_filter_header, checkpoint);
status =
<span class="self">self</span>.cf_store
.advance_to_cf_headers(index, checkpoint, resp.filter_hashes)<span class="question-mark">?</span>;
<a href="#1145" id="1145">1145</a>
<a href="#1146" id="1146">1146</a>
<a href="#1147" id="1147">1147</a>
-<a href="#1148" id="1148">1148</a>
-<a href="#1149" id="1149">1149</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="kw">let </span>child: u32 = row.get(<span class="number">1</span>).unwrap();
<span class="kw">let </span>count: usize = row.get(<span class="number">2</span>).unwrap();
- <span class="macro">assert!</span>(
- count == <span class="number">1</span>,
+ <span class="macro">assert_eq!</span>(
+ count, <span class="number">1</span>,
<span class="string">"keychain={}, child={}, count={}"</span>,
- keychain,
- child,
- count
+ keychain, child, count
);
}
}
<a href="#178" id="178">178</a>
<a href="#179" id="179">179</a>
<a href="#180" id="180">180</a>
+<a href="#181" id="181">181</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
</span><span class="kw">mod </span>test {
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="kw">use </span><span class="kw">crate</span>::descriptor::calc_checksum;
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="comment">// test calc_checksum() function; it should return the same value as Bitcoin Core
</span><span class="attr">#[test]
<span class="macro">assert_eq!</span>(calc_checksum(desc).unwrap(), <span class="string">"lasegmfs"</span>);
<span class="kw">let </span>desc = <span class="string">"wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)#tqz0nc26"</span>;
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- calc_checksum(desc).err(),
- <span class="prelude-val">Some</span>(DescriptorError::InvalidDescriptorChecksum)
- ));
+ <span class="macro">assert_matches!</span>(
+ calc_checksum(desc),
+ <span class="prelude-val">Err</span>(DescriptorError::InvalidDescriptorChecksum)
+ );
<span class="kw">let </span>desc = <span class="string">"pkh(tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/44'/1'/0'/0/*)#lasegmsf"</span>;
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- calc_checksum(desc).err(),
- <span class="prelude-val">Some</span>(DescriptorError::InvalidDescriptorChecksum)
- ));
+ <span class="macro">assert_matches!</span>(
+ calc_checksum(desc),
+ <span class="prelude-val">Err</span>(DescriptorError::InvalidDescriptorChecksum)
+ );
}
<span class="attr">#[test]
<span class="kw">let </span>sparkle_heart = <span class="kw">unsafe </span>{ std::str::from_utf8_unchecked(<span class="kw-2">&</span>[<span class="number">240</span>, <span class="number">159</span>, <span class="number">146</span>, <span class="number">150</span>]) };
<span class="kw">let </span>invalid_desc = <span class="macro">format!</span>(<span class="string">"wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcL{}fjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)"</span>, sparkle_heart);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- calc_checksum(<span class="kw-2">&</span>invalid_desc).err(),
- <span class="prelude-val">Some</span>(DescriptorError::InvalidDescriptorCharacter(invalid_char)) <span class="kw">if </span>invalid_char == sparkle_heart.as_bytes()[<span class="number">0</span>]
- ));
+ <span class="macro">assert_matches!</span>(
+ calc_checksum(<span class="kw-2">&</span>invalid_desc),
+ <span class="prelude-val">Err</span>(DescriptorError::InvalidDescriptorCharacter(invalid_char)) <span class="kw">if </span>invalid_char == sparkle_heart.as_bytes()[<span class="number">0</span>]
+ );
}
}
</code></pre></div>
<a href="#871" id="871">871</a>
<a href="#872" id="872">872</a>
<a href="#873" id="873">873</a>
-<a href="#874" id="874">874</a>
-<a href="#875" id="875">875</a>
-<a href="#876" id="876">876</a>
-<a href="#877" id="877">877</a>
-<a href="#878" id="878">878</a>
-<a href="#879" id="879">879</a>
-<a href="#880" id="880">880</a>
-<a href="#881" id="881">881</a>
-<a href="#882" id="882">882</a>
-<a href="#883" id="883">883</a>
-<a href="#884" id="884">884</a>
-<a href="#885" id="885">885</a>
-<a href="#886" id="886">886</a>
-<a href="#887" id="887">887</a>
-<a href="#888" id="888">888</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
</span><span class="kw">mod </span>test {
<span class="kw">use </span>std::str::FromStr;
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::consensus::encode::deserialize;
<span class="kw">use </span>bitcoin::hashes::hex::FromHex;
<span class="kw">use </span>bitcoin::secp256k1::Secp256k1;
<span class="kw">let </span>desc = <span class="string">"wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)#67ju93jw"
</span>.into_wallet_descriptor(<span class="kw-2">&</span>secp, Network::Testnet);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- desc.err(),
- <span class="prelude-val">Some</span>(DescriptorError::InvalidDescriptorChecksum)
- ));
+ <span class="macro">assert_matches!</span>(desc, <span class="prelude-val">Err</span>(DescriptorError::InvalidDescriptorChecksum));
<span class="kw">let </span>desc = <span class="string">"wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)#67ju93jw"
</span>.into_wallet_descriptor(<span class="kw-2">&</span>secp, Network::Testnet);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- desc.err(),
- <span class="prelude-val">Some</span>(DescriptorError::InvalidDescriptorChecksum)
- ));
+ <span class="macro">assert_matches!</span>(desc, <span class="prelude-val">Err</span>(DescriptorError::InvalidDescriptorChecksum));
}
<span class="comment">// test IntoWalletDescriptor trait from &str with keys from right and wrong network
<span class="kw">let </span>desc = <span class="string">"wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)"
</span>.into_wallet_descriptor(<span class="kw-2">&</span>secp, Network::Bitcoin);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- desc.err(),
- <span class="prelude-val">Some</span>(DescriptorError::Key(KeyError::InvalidNetwork))
- ));
+ <span class="macro">assert_matches!</span>(desc, <span class="prelude-val">Err</span>(DescriptorError::Key(KeyError::InvalidNetwork)));
<span class="kw">let </span>desc = <span class="string">"wpkh(tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/1/2/*)"
</span>.into_wallet_descriptor(<span class="kw-2">&</span>secp, Network::Bitcoin);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- desc.err(),
- <span class="prelude-val">Some</span>(DescriptorError::Key(KeyError::InvalidNetwork))
- ));
+ <span class="macro">assert_matches!</span>(desc, <span class="prelude-val">Err</span>(DescriptorError::Key(KeyError::InvalidNetwork)));
}
<span class="comment">// test IntoWalletDescriptor trait from the output of the descriptor!() macro
<span class="kw">let </span>descriptor = <span class="string">"wpkh(tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/0'/1/2/*)"</span>;
<span class="kw">let </span>result = into_wallet_descriptor_checked(descriptor, <span class="kw-2">&</span>secp, Network::Testnet);
- <span class="macro">assert!</span>(result.is_err());
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- result.unwrap_err(),
- DescriptorError::HardenedDerivationXpub
- ));
+ <span class="macro">assert_matches!</span>(result, <span class="prelude-val">Err</span>(DescriptorError::HardenedDerivationXpub));
<span class="kw">let </span>descriptor = <span class="string">"wsh(multi(2,tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/0/*,tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/0/*))"</span>;
<span class="kw">let </span>result = into_wallet_descriptor_checked(descriptor, <span class="kw-2">&</span>secp, Network::Testnet);
<a href="#1874" id="1874">1874</a>
<a href="#1875" id="1875">1875</a>
<a href="#1876" id="1876">1876</a>
-<a href="#1877" id="1877">1877</a>
-<a href="#1878" id="1878">1878</a>
-<a href="#1879" id="1879">1879</a>
-<a href="#1880" id="1880">1880</a>
-<a href="#1881" id="1881">1881</a>
-<a href="#1882" id="1882">1882</a>
-<a href="#1883" id="1883">1883</a>
-<a href="#1884" id="1884">1884</a>
-<a href="#1885" id="1885">1885</a>
-<a href="#1886" id="1886">1886</a>
-<a href="#1887" id="1887">1887</a>
-<a href="#1888" id="1888">1888</a>
-<a href="#1889" id="1889">1889</a>
-<a href="#1890" id="1890">1890</a>
-<a href="#1891" id="1891">1891</a>
-<a href="#1892" id="1892">1892</a>
-<a href="#1893" id="1893">1893</a>
-<a href="#1894" id="1894">1894</a>
-<a href="#1895" id="1895">1895</a>
-<a href="#1896" id="1896">1896</a>
-<a href="#1897" id="1897">1897</a>
-<a href="#1898" id="1898">1898</a>
-<a href="#1899" id="1899">1899</a>
-<a href="#1900" id="1900">1900</a>
-<a href="#1901" id="1901">1901</a>
-<a href="#1902" id="1902">1902</a>
-<a href="#1903" id="1903">1903</a>
-<a href="#1904" id="1904">1904</a>
-<a href="#1905" id="1905">1905</a>
-<a href="#1906" id="1906">1906</a>
-<a href="#1907" id="1907">1907</a>
-<a href="#1908" id="1908">1908</a>
-<a href="#1909" id="1909">1909</a>
-<a href="#1910" id="1910">1910</a>
-<a href="#1911" id="1911">1911</a>
-<a href="#1912" id="1912">1912</a>
-<a href="#1913" id="1913">1913</a>
-<a href="#1914" id="1914">1914</a>
-<a href="#1915" id="1915">1915</a>
-<a href="#1916" id="1916">1916</a>
-<a href="#1917" id="1917">1917</a>
-<a href="#1918" id="1918">1918</a>
-<a href="#1919" id="1919">1919</a>
-<a href="#1920" id="1920">1920</a>
-<a href="#1921" id="1921">1921</a>
-<a href="#1922" id="1922">1922</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="kw">use </span><span class="kw">crate</span>::descriptor::policy::SatisfiableItem::{EcdsaSignature, Multisig, Thresh};
<span class="kw">use </span><span class="kw">crate</span>::keys::{DescriptorKey, IntoDescriptorKey};
<span class="kw">use </span><span class="kw">crate</span>::wallet::signer::SignersContainer;
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::secp256k1::Secp256k1;
<span class="kw">use </span>bitcoin::util::bip32;
<span class="kw">use </span>bitcoin::Network;
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint));
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::None));
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint);
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::None);
<span class="kw">let </span>desc = <span class="macro">descriptor!</span>(wpkh(prvkey)).unwrap();
<span class="kw">let </span>(wallet_desc, keymap) = desc
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint));
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Complete {condition} <span class="kw">if </span>condition.csv == <span class="prelude-val">None </span>&& condition.timelock == <span class="prelude-val">None</span>)
- );
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint);
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Complete {condition} <span class="kw">if </span>condition.csv == <span class="prelude-val">None </span>&& condition.timelock == <span class="prelude-val">None</span>);
}
<span class="comment">// 2 pub keys descriptor, required 2 prv keys
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2usize
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2usize
</span>&& keys[<span class="number">0</span>] == PkOrF::Fingerprint(fingerprint0)
- && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1))
+ && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1)
);
<span class="comment">// TODO should this be "Satisfaction::None" since we have no prv keys?
// TODO should items and conditions not be empty?
- </span><span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Partial { n, m, items, conditions, ..} <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2usize
+ </span><span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Partial { n, m, items, conditions, ..} <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2usize
</span>&& m == <span class="kw-2">&</span><span class="number">2usize
</span>&& items.is_empty()
&& conditions.is_empty()
- )
);
}
.extract_policy(<span class="kw-2">&</span>signers_container, BuildSatisfaction::None, <span class="kw-2">&</span>secp)
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2usize
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2usize
</span>&& keys[<span class="number">0</span>] == PkOrF::Fingerprint(fingerprint0)
- && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1))
+ && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1)
);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Partial { n, m, items, conditions, ..} <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2usize
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::Partial { n, m, items, conditions, ..} <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2usize
</span>&& m == <span class="kw-2">&</span><span class="number">2usize
</span>&& items.len() == <span class="number">1
</span>&& conditions.contains_key(<span class="kw-2">&</span><span class="number">0</span>)
- )
);
}
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">1
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">1
</span>&& keys[<span class="number">0</span>] == PkOrF::Fingerprint(fingerprint0)
- && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1))
+ && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1)
);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
</span>&& m == <span class="kw-2">&</span><span class="number">1
</span>&& items.len() == <span class="number">2
</span>&& conditions.contains_key(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>])
&& conditions.contains_key(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">1</span>])
- )
);
}
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="kw-2">&</span><span class="number">2
</span>&& keys[<span class="number">0</span>] == PkOrF::Fingerprint(fingerprint0)
- && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1))
+ && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1)
);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items.len() == <span class="number">2
</span>&& conditions.contains_key(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>,<span class="number">1</span>])
- )
);
}
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint));
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::None));
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == <span class="kw-2">&</span>fingerprint);
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::None);
<span class="kw">let </span>desc = <span class="macro">descriptor!</span>(wpkh(prvkey)).unwrap();
<span class="kw">let </span>(wallet_desc, keymap) = desc
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == fingerprint));
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy.contribution, Satisfaction::Complete {condition} <span class="kw">if </span>condition.csv == <span class="prelude-val">None </span>&& condition.timelock == <span class="prelude-val">None</span>)
- );
+ <span class="macro">assert_matches!</span>(policy.item, EcdsaSignature(PkOrF::Fingerprint(f)) <span class="kw">if </span>f == fingerprint);
+ <span class="macro">assert_matches!</span>(policy.contribution, Satisfaction::Complete {condition} <span class="kw">if </span>condition.csv == <span class="prelude-val">None </span>&& condition.timelock == <span class="prelude-val">None</span>);
}
<span class="comment">// single key, 1 prv and 1 pub key descriptor, required 1 prv keys
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="number">1
+ <span class="macro">assert_matches!</span>(policy.item, Multisig { keys, threshold } <span class="kw">if </span>threshold == <span class="number">1
</span>&& keys[<span class="number">0</span>] == PkOrF::Fingerprint(fingerprint0)
- && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1))
+ && keys[<span class="number">1</span>] == PkOrF::Fingerprint(fingerprint1)
);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="number">2
+ <span class="macro">assert_matches!</span>(policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="number">2
</span>&& m == <span class="number">1
</span>&& items.len() == <span class="number">2
</span>&& conditions.contains_key(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>])
&& conditions.contains_key(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">1</span>])
- )
);
}
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.item, Thresh { items, threshold } <span class="kw">if </span>items.len() == <span class="number">3 </span>&& threshold == <span class="kw-2">&</span><span class="number">2</span>)
- );
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.item, Thresh { items, threshold } <span class="kw">if </span>items.len() == <span class="number">3 </span>&& threshold == <span class="kw-2">&</span><span class="number">2</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.contribution, Satisfaction::PartialComplete { n, m, items, conditions, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items.len() == <span class="number">3
</span>&& conditions.get(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>,<span class="number">1</span>]).unwrap().iter().next().unwrap().csv.is_none()
&& conditions.get(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>,<span class="number">2</span>]).unwrap().iter().next().unwrap().csv == <span class="prelude-val">Some</span>(Sequence(sequence))
&& conditions.get(<span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">1</span>,<span class="number">2</span>]).unwrap().iter().next().unwrap().csv == <span class="prelude-val">Some</span>(Sequence(sequence))
- )
);
}
.unwrap();
<span class="comment">//println!("{}", serde_json::to_string(&policy_alice_psbt).unwrap());
- </span><span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy_alice_psbt.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
+ </span><span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy_alice_psbt.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items == <span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>]
- )
);
<span class="kw">let </span>psbt = Psbt::from_str(BOB_SIGNED_PSBT).unwrap();
.unwrap();
<span class="comment">//println!("{}", serde_json::to_string(&policy_bob_psbt).unwrap());
- </span><span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy_bob_psbt.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
+ </span><span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy_bob_psbt.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items == <span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">1</span>]
- )
);
<span class="kw">let </span>psbt = Psbt::from_str(ALICE_BOB_SIGNED_PSBT).unwrap();
.extract_policy(<span class="kw-2">&</span>signers_container, BuildSatisfaction::Psbt(<span class="kw-2">&</span>psbt), <span class="kw-2">&</span>secp)
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy_alice_bob_psbt.satisfaction, Satisfaction::PartialComplete { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy_alice_bob_psbt.satisfaction, Satisfaction::PartialComplete { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">2
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items == <span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>]
- )
);
}
.extract_policy(<span class="kw-2">&</span>signers_container, build_sat, <span class="kw-2">&</span>secp)
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items.is_empty()
- )
);
<span class="comment">//println!("{}", serde_json::to_string(&policy).unwrap());
.extract_policy(<span class="kw-2">&</span>signers_container, build_sat_expired, <span class="kw-2">&</span>secp)
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy_expired.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy_expired.satisfaction, Satisfaction::Partial { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items == <span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>]
- )
);
<span class="comment">//println!("{}", serde_json::to_string(&policy_expired).unwrap());
.extract_policy(<span class="kw-2">&</span>signers_container, build_sat_expired_signed, <span class="kw-2">&</span>secp)
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(<span class="kw-2">&</span>policy_expired_signed.satisfaction, Satisfaction::PartialComplete { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
+ <span class="macro">assert_matches!</span>(<span class="kw-2">&</span>policy_expired_signed.satisfaction, Satisfaction::PartialComplete { n, m, items, .. } <span class="kw">if </span>n == <span class="kw-2">&</span><span class="number">3
</span>&& m == <span class="kw-2">&</span><span class="number">2
</span>&& items == <span class="kw-2">&</span><span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>]
- )
);
<span class="comment">//println!("{}", serde_json::to_string(&policy_expired_signed).unwrap());
</span>}
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>)
- );
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy.contribution, Satisfaction::PartialComplete { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items == <span class="macro">vec!</span>[<span class="number">1</span>])
- );
+ <span class="macro">assert_matches!</span>(policy.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>);
+ <span class="macro">assert_matches!</span>(policy.contribution, Satisfaction::PartialComplete { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items == <span class="macro">vec!</span>[<span class="number">1</span>]);
<span class="kw">let </span>alice_sig = SatisfiableItem::SchnorrSignature(PkOrF::Fingerprint(alice_fing));
<span class="kw">let </span>bob_sig = SatisfiableItem::SchnorrSignature(PkOrF::Fingerprint(bob_fing));
.unwrap()
.unwrap();
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy_unsigned.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>)
- );
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy_unsigned.satisfaction, Satisfaction::Partial { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items.is_empty())
- );
+ <span class="macro">assert_matches!</span>(policy_unsigned.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>);
+ <span class="macro">assert_matches!</span>(policy_unsigned.satisfaction, Satisfaction::Partial { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items.is_empty());
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy_signed.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>)
- );
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(policy_signed.satisfaction, Satisfaction::PartialComplete { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items == <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>])
- );
+ <span class="macro">assert_matches!</span>(policy_signed.item, SatisfiableItem::Thresh { <span class="kw-2">ref </span>items, threshold: <span class="number">1 </span>} <span class="kw">if </span>items.len() == <span class="number">2</span>);
+ <span class="macro">assert_matches!</span>(policy_signed.satisfaction, Satisfaction::PartialComplete { n: <span class="number">2</span>, m: <span class="number">1</span>, items, .. } <span class="kw">if </span>items == <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="kw">let </span>satisfied_items = <span class="kw">match </span>policy_signed.item {
SatisfiableItem::Thresh { items, .. } => items,
<a href="#777" id="777">777</a>
<a href="#778" id="778">778</a>
<a href="#779" id="779">779</a>
+<a href="#780" id="780">780</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="kw">use </span><span class="kw">crate</span>::descriptor::{DescriptorError, DescriptorMeta};
<span class="kw">use </span><span class="kw">crate</span>::keys::ValidNetworks;
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::network::constants::Network::Regtest;
<span class="kw">use </span>miniscript::descriptor::{DescriptorPublicKey, KeyMap};
<span class="kw">use </span>miniscript::Descriptor;
<span class="kw">if let </span>ExtendedDescriptor::Pkh(pkh) = xdesc.<span class="number">0 </span>{
<span class="kw">let </span>path: Vec<ChildNumber> = pkh.into_inner().full_derivation_path().into();
<span class="kw">let </span>purpose = path.get(<span class="number">0</span>).unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(purpose, Hardened { index: <span class="number">44 </span>}));
+ <span class="macro">assert_matches!</span>(purpose, Hardened { index: <span class="number">44 </span>});
<span class="kw">let </span>coin_type = path.get(<span class="number">1</span>).unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(coin_type, Hardened { index: <span class="number">0 </span>}));
+ <span class="macro">assert_matches!</span>(coin_type, Hardened { index: <span class="number">0 </span>});
}
<span class="kw">let </span>tprvkey = bitcoin::util::bip32::ExtendedPrivKey::from_str(<span class="string">"tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy"</span>).unwrap();
<span class="kw">if let </span>ExtendedDescriptor::Pkh(pkh) = tdesc.<span class="number">0 </span>{
<span class="kw">let </span>path: Vec<ChildNumber> = pkh.into_inner().full_derivation_path().into();
<span class="kw">let </span>purpose = path.get(<span class="number">0</span>).unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(purpose, Hardened { index: <span class="number">44 </span>}));
+ <span class="macro">assert_matches!</span>(purpose, Hardened { index: <span class="number">44 </span>});
<span class="kw">let </span>coin_type = path.get(<span class="number">1</span>).unwrap();
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(coin_type, Hardened { index: <span class="number">1 </span>}));
+ <span class="macro">assert_matches!</span>(coin_type, Hardened { index: <span class="number">1 </span>});
}
}
<a href="#283" id="283">283</a>
<a href="#284" id="284">284</a>
<a href="#285" id="285">285</a>
+<a href="#286" id="286">286</a>
+<a href="#287" id="287">287</a>
+<a href="#288" id="288">288</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
#[macro_use]
</span><span class="kw">pub mod </span>testutils;
+<span class="attr">#[cfg(test)]
+</span><span class="kw">extern crate </span>assert_matches;
+
<span class="attr">#[allow(unused_imports)]
#[macro_use]
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>error;
<a href="#1593" id="1593">1593</a>
<a href="#1594" id="1594">1594</a>
<a href="#1595" id="1595">1595</a>
-<a href="#1596" id="1596">1596</a>
-<a href="#1597" id="1597">1597</a>
-<a href="#1598" id="1598">1598</a>
-<a href="#1599" id="1599">1599</a>
-<a href="#1600" id="1600">1600</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="kw">use </span>bitcoin::consensus::encode::serialize;
<span class="kw">use </span>bitcoin::Script;
+<span class="attr">#[cfg(test)]
+</span><span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>rand::seq::SliceRandom;
<span class="attr">#[cfg(not(test))]
</span><span class="kw">use </span>rand::thread_rng;
-<span class="attr">#[cfg(test)]
-</span><span class="kw">use </span>rand::{rngs::StdRng, SeedableRng};
<span class="kw">use </span>std::collections::HashMap;
<span class="kw">use </span>std::convert::TryInto;
</span>optional_utxos.shuffle(<span class="kw-2">&mut </span>thread_rng());
<span class="attr">#[cfg(test)]
</span>{
+ <span class="kw">use </span>rand::{rngs::StdRng, SeedableRng};
<span class="kw">let </span>seed = [<span class="number">0</span>; <span class="number">32</span>];
<span class="kw">let </span><span class="kw-2">mut </span>rng: StdRng = SeedableRng::from_seed(seed);
optional_utxos.shuffle(<span class="kw-2">&mut </span>rng);
<span class="kw">let </span>database = MemoryDatabase::default();
<span class="kw">let </span>drain_script = Script::default();
- <span class="kw">let </span>err = BranchAndBoundCoinSelection::default()
- .coin_select(
- <span class="kw-2">&</span>database,
- <span class="macro">vec!</span>[],
- utxos,
- FeeRate::from_sat_per_vb(<span class="number">10.0</span>),
- <span class="number">500_000</span>,
- <span class="kw-2">&</span>drain_script,
- )
- .unwrap_err();
+ <span class="kw">let </span>selection = BranchAndBoundCoinSelection::default().coin_select(
+ <span class="kw-2">&</span>database,
+ <span class="macro">vec!</span>[],
+ utxos,
+ FeeRate::from_sat_per_vb(<span class="number">10.0</span>),
+ <span class="number">500_000</span>,
+ <span class="kw-2">&</span>drain_script,
+ );
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- err,
- Error::InsufficientFunds {
+ <span class="macro">assert_matches!</span>(
+ selection,
+ <span class="prelude-val">Err</span>(Error::InsufficientFunds {
available: <span class="number">300_000</span>,
..
- }
- ));
+ })
+ );
}
<span class="attr">#[test]
.into_iter()
.partition(|u| <span class="macro">matches!</span>(u, WeightedUtxo { utxo, .. } <span class="kw">if </span>utxo.txout().value < <span class="number">1000</span>));
- <span class="kw">let </span>err = BranchAndBoundCoinSelection::default()
- .coin_select(
- <span class="kw-2">&</span>database,
- required,
- optional,
- FeeRate::from_sat_per_vb(<span class="number">10.0</span>),
- <span class="number">500_000</span>,
- <span class="kw-2">&</span>drain_script,
- )
- .unwrap_err();
+ <span class="kw">let </span>selection = BranchAndBoundCoinSelection::default().coin_select(
+ <span class="kw-2">&</span>database,
+ required,
+ optional,
+ FeeRate::from_sat_per_vb(<span class="number">10.0</span>),
+ <span class="number">500_000</span>,
+ <span class="kw-2">&</span>drain_script,
+ );
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- err,
- Error::InsufficientFunds {
+ <span class="macro">assert_matches!</span>(
+ selection,
+ <span class="prelude-val">Err</span>(Error::InsufficientFunds {
available: <span class="number">300_010</span>,
..
- }
- ));
+ })
+ );
}
<span class="attr">#[test]
<span class="kw">let </span>database = MemoryDatabase::default();
<span class="kw">let </span>drain_script = Script::default();
- <span class="kw">let </span>err = BranchAndBoundCoinSelection::default()
- .coin_select(
- <span class="kw-2">&</span>database,
- utxos,
- <span class="macro">vec!</span>[],
- FeeRate::from_sat_per_vb(<span class="number">10_000.0</span>),
- <span class="number">500_000</span>,
- <span class="kw-2">&</span>drain_script,
- )
- .unwrap_err();
+ <span class="kw">let </span>selection = BranchAndBoundCoinSelection::default().coin_select(
+ <span class="kw-2">&</span>database,
+ utxos,
+ <span class="macro">vec!</span>[],
+ FeeRate::from_sat_per_vb(<span class="number">10_000.0</span>),
+ <span class="number">500_000</span>,
+ <span class="kw-2">&</span>drain_script,
+ );
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- err,
- Error::InsufficientFunds {
+ <span class="macro">assert_matches!</span>(
+ selection,
+ <span class="prelude-val">Err</span>(Error::InsufficientFunds {
available: <span class="number">300_010</span>,
..
- }
- ));
+ })
+ );
}
}
</code></pre></div>
<a href="#5572" id="5572">5572</a>
<a href="#5573" id="5573">5573</a>
<a href="#5574" id="5574">5574</a>
-<a href="#5575" id="5575">5575</a>
-<a href="#5576" id="5576">5576</a>
-<a href="#5577" id="5577">5577</a>
-<a href="#5578" id="5578">5578</a>
-<a href="#5579" id="5579">5579</a>
-<a href="#5580" id="5580">5580</a>
-<a href="#5581" id="5581">5581</a>
-<a href="#5582" id="5582">5582</a>
-<a href="#5583" id="5583">5583</a>
-<a href="#5584" id="5584">5584</a>
-<a href="#5585" id="5585">5585</a>
-<a href="#5586" id="5586">5586</a>
-<a href="#5587" id="5587">5587</a>
-<a href="#5588" id="5588">5588</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="attr">#[cfg(test)]
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>test {
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::{util::psbt, Network, PackedLockTime, Sequence};
<span class="kw">use </span><span class="kw">crate</span>::database::Database;
result.is_err(),
<span class="string">"Signing should have failed because the TX uses non-standard sighashes"
</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(
- result.unwrap_err(),
- Error::Signer(SignerError::NonStandardSighash)
- ),
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Err</span>(Error::Signer(SignerError::NonStandardSighash)),
<span class="string">"Signing failed with the wrong error type"
</span>);
..Default::default()
},
);
- <span class="macro">assert!</span>(
- result.is_err(),
- <span class="string">"Signing should have failed because the witness_utxo is missing"
- </span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(
- result.unwrap_err(),
- Error::Signer(SignerError::MissingWitnessUtxo)
- ),
- <span class="string">"Signing failed with the wrong error type"
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Err</span>(Error::Signer(SignerError::MissingWitnessUtxo)),
+ <span class="string">"Signing should have failed with the correct error because the witness_utxo is missing"
</span>);
<span class="comment">// restore the witness_utxo
},
);
- <span class="macro">assert!</span>(result.is_ok(), <span class="string">"Signing should have worked"</span>);
- <span class="macro">assert!</span>(
- result.unwrap(),
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Ok</span>(<span class="bool-val">true</span>),
<span class="string">"Should finalize the input since we can produce signatures"
</span>);
}
result.is_err(),
<span class="string">"Signing should have failed because the TX uses non-standard sighashes"
</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(
- result.unwrap_err(),
- Error::Signer(SignerError::NonStandardSighash)
- ),
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Err</span>(Error::Signer(SignerError::NonStandardSighash)),
<span class="string">"Signing failed with the wrong error type"
</span>);
result.is_err(),
<span class="string">"Signing should have failed because the witness_utxo is missing"
</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(
- result.unwrap_err(),
- Error::Signer(SignerError::MissingWitnessUtxo)
- ),
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Err</span>(Error::Signer(SignerError::MissingWitnessUtxo)),
<span class="string">"Signing failed with the wrong error type"
</span>);
builder
.add_recipient(addr.script_pubkey(), balance.immature / <span class="number">2</span>)
.current_height(confirmation_time);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- builder.finish().unwrap_err(),
- Error::InsufficientFunds {
+ <span class="macro">assert_matches!</span>(
+ builder.finish(),
+ <span class="prelude-val">Err</span>(Error::InsufficientFunds {
needed: <span class="kw">_</span>,
available: <span class="number">0
- </span>}
- ));
+ </span>})
+ );
<span class="comment">// Still unspendable...
</span><span class="kw">let </span><span class="kw-2">mut </span>builder = wallet.build_tx();
builder
.add_recipient(addr.script_pubkey(), balance.immature / <span class="number">2</span>)
.current_height(not_yet_mature_time);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- builder.finish().unwrap_err(),
- Error::InsufficientFunds {
+ <span class="macro">assert_matches!</span>(
+ builder.finish(),
+ <span class="prelude-val">Err</span>(Error::InsufficientFunds {
needed: <span class="kw">_</span>,
available: <span class="number">0
- </span>}
- ));
+ </span>})
+ );
<span class="comment">// ...Now the coinbase is mature :)
</span><span class="kw">let </span>sync_time = SyncTime {
builder.add_recipient(addr.script_pubkey(), <span class="number">0</span>);
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(
- builder.finish().unwrap_err(),
- Error::OutputBelowDustLimit(<span class="number">0</span>)
- ));
+ <span class="macro">assert_matches!</span>(builder.finish(), <span class="prelude-val">Err</span>(Error::OutputBelowDustLimit(<span class="number">0</span>)));
<span class="kw">let </span><span class="kw-2">mut </span>builder = wallet.build_tx();
<a href="#1121" id="1121">1121</a>
<a href="#1122" id="1122">1122</a>
<a href="#1123" id="1123">1123</a>
+<a href="#1124" id="1124">1124</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
//
<span class="kw">use </span><span class="kw">crate</span>::descriptor;
<span class="kw">use </span><span class="kw">crate</span>::descriptor::IntoWalletDescriptor;
<span class="kw">use </span><span class="kw">crate</span>::keys::{DescriptorKey, IntoDescriptorKey};
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::secp256k1::{All, Secp256k1};
<span class="kw">use </span>bitcoin::util::bip32;
<span class="kw">use </span>bitcoin::Network;
signers.add_external(id2.clone(), SignerOrdering(<span class="number">2</span>), signer2.clone());
signers.add_external(id3.clone(), SignerOrdering(<span class="number">3</span>), signer3.clone());
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(signers.find(id1), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer1)));
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(signers.find(id2), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer2)));
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(signers.find(id3.clone()), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer3)));
+ <span class="macro">assert_matches!</span>(signers.find(id1), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer1));
+ <span class="macro">assert_matches!</span>(signers.find(id2), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer2));
+ <span class="macro">assert_matches!</span>(signers.find(id3.clone()), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer3));
<span class="comment">// The `signer4` has the same ID as `signer3` but lower ordering.
// It should be found by `id3` instead of `signer3`.
</span>signers.add_external(id3.clone(), SignerOrdering(<span class="number">2</span>), signer4.clone());
- <span class="macro">assert!</span>(<span class="macro">matches!</span>(signers.find(id3), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer4)));
+ <span class="macro">assert_matches!</span>(signers.find(id3), <span class="prelude-val">Some</span>(signer) <span class="kw">if </span>is_equal(signer, <span class="kw-2">&</span>signer4));
<span class="comment">// Can't find anything with ID that doesn't exist
- </span><span class="macro">assert!</span>(<span class="macro">matches!</span>(signers.find(id_nonexistent), <span class="prelude-val">None</span>));
+ </span><span class="macro">assert_matches!</span>(signers.find(id_nonexistent), <span class="prelude-val">None</span>);
}
<span class="attr">#[derive(Debug, Clone, Copy)]
<a href="#159" id="159">159</a>
<a href="#160" id="160">160</a>
<a href="#161" id="161">161</a>
-<a href="#162" id="162">162</a>
</pre><pre class="rust"><code><span class="comment">// Bitcoin Dev Kit
// Written in 2021 by Alekos Filini <alekos.filini@gmail.com>
//
</span><span class="kw">mod </span>test {
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="kw">use </span><span class="kw">crate</span>::database::{BatchOperations, MemoryDatabase};
+ <span class="kw">use </span>assert_matches::assert_matches;
<span class="kw">use </span>bitcoin::consensus::encode::deserialize;
<span class="kw">use </span>bitcoin::hashes::hex::FromHex;
<span class="kw">use </span>bitcoin::{Transaction, Txid};
}
<span class="kw">let </span>result = verify_tx(<span class="kw-2">&</span>signed_tx, <span class="kw-2">&</span>database, <span class="kw-2">&</span>blockchain);
- <span class="macro">assert!</span>(result.is_err(), <span class="string">"Should fail with missing input tx"</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(result, <span class="prelude-val">Err</span>(VerifyError::MissingInputTx(txid)) <span class="kw">if </span>txid == prev_tx.txid()),
+ <span class="macro">assert_matches!</span>(result, <span class="prelude-val">Err</span>(VerifyError::MissingInputTx(txid)) <span class="kw">if </span>txid == prev_tx.txid(),
<span class="string">"Error should be a `MissingInputTx` error"
</span>);
</span>database.set_raw_tx(<span class="kw-2">&</span>prev_tx).unwrap();
<span class="kw">let </span>result = verify_tx(<span class="kw-2">&</span>unsigned_tx, <span class="kw-2">&</span>database, <span class="kw-2">&</span>blockchain);
- <span class="macro">assert!</span>(result.is_err(), <span class="string">"Should fail since the TX is unsigned"</span>);
- <span class="macro">assert!</span>(
- <span class="macro">matches!</span>(result, <span class="prelude-val">Err</span>(VerifyError::Consensus(<span class="kw">_</span>))),
+ <span class="macro">assert_matches!</span>(
+ result,
+ <span class="prelude-val">Err</span>(VerifyError::Consensus(<span class="kw">_</span>)),
<span class="string">"Error should be a `Consensus` error"
</span>);