Browse Source

Prefer pub(crate) over pub(super)

It does the same job for us and it makes it easier to move things
around later.
no-contract-setup-message
Lucas Soriano del Pino 3 years ago
parent
commit
e395876cc1
No known key found for this signature in database GPG Key ID: EE611E973A1530E7
  1. 2
      cfd_protocol/src/interval/digit_decomposition.rs
  2. 2
      cfd_protocol/src/protocol/sighash_ext.rs
  3. 26
      cfd_protocol/src/protocol/transactions.rs

2
cfd_protocol/src/interval/digit_decomposition.rs

@ -122,7 +122,7 @@ fn middle_grouping(first_digit_start: usize, first_digit_end: usize) -> Vec<Vec<
}
/// Returns the set of decomposed prefixes that cover the range [start, end].
pub(super) fn group_by_ignoring_digits(
pub(crate) fn group_by_ignoring_digits(
start: usize,
end: usize,
base: usize,

2
cfd_protocol/src/protocol/sighash_ext.rs

@ -1,7 +1,7 @@
use bdk::bitcoin::hashes::Hash;
use bdk::bitcoin::SigHash;
pub(super) trait SigHashExt {
pub(crate) trait SigHashExt {
fn to_message(self) -> secp256k1_zkp::Message;
}

26
cfd_protocol/src/protocol/transactions.rs

@ -20,7 +20,7 @@ use std::iter::FromIterator;
/// In satoshi per vbyte.
const SATS_PER_VBYTE: f64 = 1.0;
pub(super) fn lock_transaction(
pub(crate) fn lock_transaction(
maker_psbt: PartiallySignedTransaction,
taker_psbt: PartiallySignedTransaction,
maker_pk: PublicKey,
@ -80,7 +80,7 @@ pub(super) fn lock_transaction(
}
#[derive(Debug, Clone)]
pub(super) struct CommitTransaction {
pub(crate) struct CommitTransaction {
inner: Transaction,
descriptor: Descriptor<PublicKey>,
amount: Amount,
@ -94,7 +94,7 @@ impl CommitTransaction {
/// buffer to account for different signature lengths.
const SIGNED_VBYTES: f64 = 148.5 + (3.0 * 2.0) / 4.0;
pub(super) fn new(
pub(crate) fn new(
lock_tx: &Transaction,
(maker_pk, maker_rev_pk, maker_publish_pk): (PublicKey, PublicKey, PublicKey),
(taker_pk, taker_rev_pk, taker_publish_pk): (PublicKey, PublicKey, PublicKey),
@ -152,7 +152,7 @@ impl CommitTransaction {
})
}
pub(super) fn encsign(
pub(crate) fn encsign(
&self,
sk: SecretKey,
publish_them_pk: &PublicKey,
@ -165,7 +165,7 @@ impl CommitTransaction {
)
}
pub(super) fn into_inner(self) -> Transaction {
pub(crate) fn into_inner(self) -> Transaction {
self.inner
}
@ -189,7 +189,7 @@ impl CommitTransaction {
}
#[derive(Debug, Clone)]
pub(super) struct ContractExecutionTransaction {
pub(crate) struct ContractExecutionTransaction {
inner: Transaction,
msg_nonce_pairs: Vec<(Vec<u8>, schnorrsig::PublicKey)>,
sighash: SigHash,
@ -201,7 +201,7 @@ impl ContractExecutionTransaction {
/// buffer to account for different signature lengths.
const SIGNED_VBYTES: f64 = 206.5 + (3.0 * 2.0) / 4.0;
pub(super) fn new(
pub(crate) fn new(
commit_tx: &CommitTransaction,
payout: Payout,
maker_address: &Address,
@ -253,7 +253,7 @@ impl ContractExecutionTransaction {
})
}
pub(super) fn encsign(
pub(crate) fn encsign(
&self,
sk: SecretKey,
oracle_pk: &schnorrsig::PublicKey,
@ -268,13 +268,13 @@ impl ContractExecutionTransaction {
))
}
pub(super) fn into_inner(self) -> Transaction {
pub(crate) fn into_inner(self) -> Transaction {
self.inner
}
}
#[derive(Debug, Clone)]
pub(super) struct RefundTransaction {
pub(crate) struct RefundTransaction {
inner: Transaction,
sighash: SigHash,
commit_output_descriptor: Descriptor<PublicKey>,
@ -285,7 +285,7 @@ impl RefundTransaction {
/// buffer to account for different signature lengths.
const SIGNED_VBYTES: f64 = 206.5 + (3.0 * 2.0) / 4.0;
pub(super) fn new(
pub(crate) fn new(
commit_tx: &CommitTransaction,
relative_locktime_in_blocks: u32,
maker_address: &Address,
@ -337,11 +337,11 @@ impl RefundTransaction {
}
}
pub(super) fn sighash(&self) -> SigHash {
pub(crate) fn sighash(&self) -> SigHash {
self.sighash
}
pub(super) fn into_inner(self) -> Transaction {
pub(crate) fn into_inner(self) -> Transaction {
self.inner
}
}

Loading…
Cancel
Save