forked from bitcoin/bitcoin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bitcoin#37 from LNP-BP/feat-wallet
Functions required for full wallet support
- Loading branch information
Showing
6 changed files
with
257 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// LNP/BP Rust Library | ||
// Written in 202 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
// the public domain worldwide. This software is distributed without | ||
// any warranty. | ||
// | ||
// You should have received a copy of the MIT License | ||
// along with this software. | ||
// If not, see <https://opensource.org/licenses/MIT>. | ||
|
||
|
||
use bitcoin::Txid; | ||
use bitcoin::hashes::sha256d; | ||
|
||
use super::{ContractId, data::amount, Seal, Transition}; | ||
|
||
|
||
///! Structures required for full validation of a given state transfer | ||
|
||
/// Part of the LNPBP-5 multimessage commitment | ||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display)] | ||
#[display_from(Debug)] | ||
pub enum CommitmentProofItem { | ||
/// We commit to the item at this place | ||
Placeholder, | ||
/// Some other commitment | ||
Hash(sha256d::Hash), | ||
} | ||
|
||
/// Whole LNPBP-5 multimessage commitment as a vector of individual commitments | ||
pub type CommitmentProof = Vec<CommitmentProofItem>; | ||
|
||
/// Proves information on how a given transition committment is placed withing | ||
/// some LNPBP-5 multimessage commitment | ||
#[derive(Clone, PartialEq, Debug, Display)] | ||
#[display_from(Debug)] | ||
pub struct MultimessageReveal { | ||
pub transition: Transition, | ||
pub commitment_proof: CommitmentProof | ||
} | ||
|
||
/// Proves source of the state data. | ||
/// The state is represented by a raw non-encrypted data is not provided | ||
/// as a part of the proof, so we don't need this option here. | ||
#[non_exhaustive] | ||
#[derive(Clone, PartialEq, Debug, Display)] | ||
#[display_from(Debug)] | ||
pub enum DataReveal { | ||
/// Confidential amount disclosure | ||
Balance(amount::Proof), | ||
} | ||
|
||
/// Provides source for the seal data | ||
#[derive(Clone, PartialEq, Debug, Display)] | ||
#[display_from(Debug)] | ||
pub struct StateReveal { | ||
/// Seal definition that contains an assigned state | ||
pub seal: Seal, | ||
/// Assigned state source data | ||
pub data_proof: DataReveal, | ||
} | ||
|
||
#[derive(Clone, PartialEq, Debug, Display)] | ||
#[display_from(Debug)] | ||
pub struct Proof { | ||
/// Contract id | ||
pub contract_id: ContractId, | ||
|
||
/// History of state transition (graph serialized in a linear vec) | ||
pub transition_history: Vec<MultimessageReveal>, | ||
|
||
/// Reveals information all all confidential states | ||
pub state_proofs: Vec<StateReveal>, | ||
|
||
/// Optional list of the witness transaction ids | ||
pub witness_txids: Option<Vec<Txid>>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters