-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: sender and receiver protocols use bytes (not hex string) in wal…
…let database (#5950) Description --- Changed the sender and receiver protocol in the wallet database to use bytes instead of a hex string, as the underlying data type is encrypted bytes. This issue was highlighted due to the to_hex function in tari_utilities not being able to convert large transactions into hex strings (returned **String to large**) for saving in the wallet database. Motivation and Context --- See above. How Has This Been Tested? --- Existing unit tests and cucumber tests passed Added a new integration-level unit test `async fn large_interactive_transaction()` to test the conversion from pending outgoing and incoming transactions to and from the database. What process can a PR reviewer use to test or verify this change? --- Code walk-through Run the new unit test <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain --> Co-authored-by: SW van Heerden <swvheerden@gmail.com>
- Loading branch information
1 parent
4870c49
commit 4cbdfec
Showing
6 changed files
with
252 additions
and
58 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
base_layer/wallet/migrations/2023-11-13-082000_transaction_protocols/down.sql
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 @@ | ||
-- This file should undo anything in `up.sql` |
36 changes: 36 additions & 0 deletions
36
base_layer/wallet/migrations/2023-11-13-082000_transaction_protocols/up.sql
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,36 @@ | ||
-- Any old 'inbound_transactions' will not be valid due to the change in 'receiver_protocol' to 'BLOB', so we drop and | ||
-- recreate the table. | ||
|
||
DROP TABLE inbound_transactions; | ||
CREATE TABLE inbound_transactions | ||
( | ||
tx_id BIGINT PRIMARY KEY NOT NULL, | ||
source_address BLOB NOT NULL, | ||
amount BIGINT NOT NULL, | ||
receiver_protocol BLOB NOT NULL, | ||
message TEXT NOT NULL, | ||
timestamp DATETIME NOT NULL, | ||
cancelled INTEGER NOT NULL, | ||
direct_send_success INTEGER DEFAULT 0 NOT NULL, | ||
send_count INTEGER DEFAULT 0 NOT NULL, | ||
last_send_timestamp DATETIME NULL | ||
); | ||
|
||
-- Any old 'outbound_transactions' will not be valid due to the change in 'sender_protocol' to 'BLOB', so we drop and | ||
-- recreate the table. | ||
|
||
DROP TABLE outbound_transactions; | ||
CREATE TABLE outbound_transactions | ||
( | ||
tx_id BIGINT PRIMARY KEY NOT NULL, | ||
destination_address BLOB NOT NULL, | ||
amount BIGINT NOT NULL, | ||
fee BIGINT NOT NULL, | ||
sender_protocol BLOB NOT NULL, | ||
message TEXT NOT NULL, | ||
timestamp DATETIME NOT NULL, | ||
cancelled INTEGER DEFAULT 0 NOT NULL, | ||
direct_send_success INTEGER DEFAULT 0 NOT NULL, | ||
send_count INTEGER DEFAULT 0 NOT NULL, | ||
last_send_timestamp DATETIME NULL | ||
); |
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
Oops, something went wrong.