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

feat!: add support for specifying custom messages for scanned outputs in libwallet #3871

Conversation

philipr-za
Copy link
Contributor

Description

This PR adds the ability for clients to specify custom text messages to be added to outputs that are recovered or one-sided payments that are scanned from the blockchain.
These messages were hardcoded before by clients should be able to specify their own so that localized messages can be provided in the future. The PR adds the ability to specify these messages when constucting the Utxo Scanner Service and also provides the interface to update these messages while the wallet is running.

In the FFI interface the wallet_start_recovery method was updated to accept a custom Recovery Output message. For the One-Sided payment custom message the wallet_set_one_sided_payment_message method was added to allow the client to set the One sided payment message after the Wallet has been created.

How Has This Been Tested?

While working on this PR it was noted that the testing harness for the Utxo Scanner Service needed some updating and needed tests added that tested the the One-sided payment scanning. While writing these tests a bug was found in the Utxo Scanning logic that meant the tip block was only scanned every second block that was received. This bug was fixed

… in lib wallet

This PR adds the ability for clients to specify custom text messages to be added to outputs that are recovered or one-sided payments that are scanned from the blockchain.
These messages were hardcoded before by clients should be able to specify their own so that localized messages can be provided in the future. The PR adds the ability to specify these messages when constucting the Utxo Scanner Service and also provides the interface to update these messages while the wallet is running.

In the FFI interface the `wallet_start_recovery` method was updated to accept a custom Recovery Output message. For the One-Sided payment custom message the `wallet_set_one_sided_payment_message` method was added to allow the client to set the One sided payment message after the Wallet has been created.

While working on this PR it was noted that the testing harness for the Utxo Scanner Service needed some updating and needed tests added that tested the the One-sided payment scanning. While writing these tests a bug was found in the Utxo Scanning logic that meant the tip clock was only scanned every second block that was received. This bug was fixed.
@@ -207,42 +206,76 @@ where TBackend: WalletBackend + 'static
loop {
let tip_header = self.get_chain_tip_header(&mut client).await?;
let tip_header_hash = tip_header.hash();
let start_block = self.get_start_scanned_block(tip_header.height, &mut client).await?;
let last_scanned_block = self.get_last_scanned_block(tip_header.height, &mut client).await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file's updates were fixing the bug in scanning one-sided payments.

Copy link
Contributor

@delta1 delta1 left a comment

Choose a reason for hiding this comment

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

Looks great. Untested but all CI passed

let source_public_key = self.resources.node_identity.public_key().clone();
// Because we do not know the source public key we are making it the default key of zeroes to make it clear this
// value is a placeholder.
let source_public_key = CommsPublicKey::default();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@aviator-app aviator-app bot merged commit 0d7f8fc into tari-project:development Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants