lnp/channel/bolt/extensions/
anchor_outputs.rs

1// LNP/BP Core Library implementing LNPBP specifications & standards
2// Written in 2020-2022 by
3//     Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
4//
5// To the extent possible under law, the author(s) have dedicated all
6// copyright and related and neighboring rights to this software to
7// the public domain worldwide. This software is distributed without
8// any warranty.
9//
10// You should have received a copy of the MIT License
11// along with this software.
12// If not, see <https://opensource.org/licenses/MIT>.
13
14use p2p::bolt::Messages;
15
16use crate::channel::bolt::{BoltExt, ChannelState, Error};
17use crate::channel::tx_graph::TxGraph;
18use crate::{ChannelExtension, Extension};
19
20#[derive(Debug, Default)]
21pub struct AnchorOutputs;
22
23impl Extension<BoltExt> for AnchorOutputs {
24    #[inline]
25    fn identity(&self) -> BoltExt {
26        BoltExt::AnchorOutputs
27    }
28
29    fn update_from_local(&mut self, _message: &()) -> Result<(), Error> {
30        // Nothing to do here so far
31        Ok(())
32    }
33
34    #[inline]
35    fn update_from_peer(&mut self, _: &Messages) -> Result<(), Error> {
36        // TODO: Implement
37        Ok(())
38    }
39
40    fn load_state(&mut self, _state: &ChannelState) {
41        // Nothing to do here
42    }
43
44    fn store_state(&self, _state: &mut ChannelState) {
45        // Nothing to do here
46    }
47}
48
49impl ChannelExtension<BoltExt> for AnchorOutputs {
50    #[inline]
51    fn new() -> Box<dyn ChannelExtension<BoltExt>>
52    where
53        Self: Sized,
54    {
55        Box::default() as Box<AnchorOutputs>
56    }
57
58    #[inline]
59    fn build_graph(
60        &self,
61        _tx_graph: &mut TxGraph,
62        _as_remote_node: bool,
63    ) -> Result<(), Error> {
64        todo!("implement anchor outputs")
65    }
66}