Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: the address of keychain internal also tweak #273

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl Exec for RgbArgs {
WalletAll(&'w RgbWallet<Wallet<XpubDerivable, RgbDescr>>),
NoWallet,
}
impl<'w> AssignmentsFilter for Filter<'w> {
impl AssignmentsFilter for Filter<'_> {
fn should_include(
&self,
outpoint: impl Into<XOutpoint>,
Expand All @@ -589,7 +589,7 @@ impl Exec for RgbArgs {
}
}
}
impl<'w> Filter<'w> {
impl Filter<'_> {
fn comment(&self, outpoint: XOutpoint) -> &'static str {
let outpoint = outpoint
.into_bp()
Expand Down
3 changes: 2 additions & 1 deletion src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ impl<K: DeriveXOnly> Derive<DerivedScript> for TapretKey<K> {
let index = index.into();
let terminal = Terminal::new(keychain, index);
let internal_key = self.tr.as_internal_key().derive(keychain, index);
if keychain.into_inner() == RgbKeychain::Tapret as u8 {
let keychain = keychain.into_inner();
if keychain == RgbKeychain::Internal as u8 || keychain == RgbKeychain::Tapret as u8 {
Comment on lines +167 to +168
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant let's just remove these to lines (the check) altogether

if let Some(tweak) = self.tweaks.get(&terminal) {
let script_commitment = TapScript::commit(tweak);
let tap_tree = TapTree::with_single_leaf(script_commitment);
Expand Down
24 changes: 9 additions & 15 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ pub struct WalletOutpointsFilter<'a, K, D: DescriptorRgb<K>, L2: Layer2>(pub &'a

// We need manual derivation to ensure we can be copied and cloned even if descriptor is not
// copyable/clonable.
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletOutpointsFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletOutpointsFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletOutpointsFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletOutpointsFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletOutpointsFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletOutpointsFilter<'_, K, D, L2> {
fn should_include(&self, output: impl Into<XOutpoint>, _: Option<XWitnessId>) -> bool {
match output.into().into_bp() {
Bp::Bitcoin(outpoint) => self.0.has_outpoint(outpoint),
Expand All @@ -49,14 +47,12 @@ pub struct WalletUnspentFilter<'a, K, D: DescriptorRgb<K>, L2: Layer2>(pub &'a W

// We need manual derivation to ensure we can be copied and cloned even if descriptor is not
// copyable/clonable.
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletUnspentFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletUnspentFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletUnspentFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletUnspentFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletUnspentFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletUnspentFilter<'_, K, D, L2> {
fn should_include(&self, output: impl Into<XOutpoint>, _: Option<XWitnessId>) -> bool {
match output.into().into_bp() {
Bp::Bitcoin(outpoint) => self.0.is_unspent(outpoint),
Expand All @@ -69,14 +65,12 @@ pub struct WalletWitnessFilter<'a, K, D: DescriptorRgb<K>, L2: Layer2>(pub &'a W

// We need manual derivation to ensure we can be copied and cloned even if descriptor is not
// copyable/clonable.
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletWitnessFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletWitnessFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletWitnessFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletWitnessFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletWitnessFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletWitnessFilter<'_, K, D, L2> {
fn should_include(&self, _: impl Into<XOutpoint>, witness_id: Option<XWitnessId>) -> bool {
self.0
.history()
Expand Down
4 changes: 1 addition & 3 deletions src/pay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ struct ContractOutpointsFilter<
}

impl<
'stock,
'wallet,
W: WalletProvider<K, L2> + ?Sized,
K,
S: StashProvider,
H: StateProvider,
P: IndexProvider,
L2: Layer2,
> AssignmentsFilter for ContractOutpointsFilter<'stock, 'wallet, W, K, S, H, P, L2>
> AssignmentsFilter for ContractOutpointsFilter<'_, '_, W, K, S, H, P, L2>
where W::Descr: DescriptorRgb<K>
{
fn should_include(&self, output: impl Into<XOutpoint>, id: Option<XWitnessId>) -> bool {
Expand Down
Loading