1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use lnp2p::bolt::Messages;
use wallet::lex_order::LexOrder;
use crate::channel::bolt::{BoltExt, ChannelState, Error};
use crate::channel::tx_graph::TxGraph;
use crate::{channel, extension, ChannelExtension, Extension};
#[derive(Debug, Default)]
pub struct Bip96;
impl Extension<BoltExt> for Bip96 {
#[inline]
fn identity(&self) -> BoltExt {
BoltExt::Bip96
}
fn update_from_local(&mut self, _message: &()) -> Result<(), Error> {
Ok(())
}
#[inline]
fn update_from_peer(&mut self, _: &Messages) -> Result<(), Error> {
Ok(())
}
fn load_state(&mut self, _state: &ChannelState) {
}
fn store_state(&self, _state: &mut ChannelState) {
}
}
impl<N> ChannelExtension<N> for Bip96
where
Self: Extension<N>,
N: channel::Nomenclature,
N::State: channel::State,
{
#[inline]
fn new() -> Box<dyn ChannelExtension<N>>
where
Self: Sized,
{
Box::new(Bip96::default())
}
#[inline]
fn build_graph(
&self,
tx_graph: &mut TxGraph,
_as_remote_node: bool,
) -> Result<(), <N as extension::Nomenclature>::Error> {
tx_graph.cmt_outs.lex_order();
tx_graph
.vec_mut()
.into_iter()
.for_each(|(_, _, tx)| tx.lex_order());
Ok(())
}
}