Commit graph

7364 commits

Author SHA1 Message Date
Doyle f47efd713a Introduce LNS update transaction to update the underlying value mapping 2020-02-20 09:34:25 +11:00
Jason Rhinelander f2f0d947f7
Allow get_staking_requirement to return current height (#1038)
This allows it to be used to fetch the current staking requirement by
just asking for a height of 0, while currently you'd first have to fetch
the height and then pass that in.
2020-02-20 09:28:16 +11:00
Jason Rhinelander 391e89e7ed
Merge pull request #1043 from Doy-lee/LokiNameSystemSweepAllFix
Undo line deletes and make a copy of change_dts in transfer_selected_rct
2020-02-19 12:49:17 -04:00
Jason Rhinelander 9561ce47c2
Fix priority=5 not doing an actual blink submission (#1041)
The RPC wallet `fill_response` calls were still passing `req.blink` to
blink a tx, but that is supposed to be deprecated in favour of passing
(just) `priority=5`.  Fixed it to blink based on the priority instead.
2020-02-19 15:57:21 +11:00
Doyle 78530e4c50 Undo line deletes and make a copy of change_dts in transfer_selected_rct
construct_tx_and_get_tx_key modifies the splitted_dsts vector which can
change the value of the reference I took to the dts entry. This change
undoes that and restores the behaviour to make a copy of the dst.
2020-02-19 15:52:41 +11:00
Doyle a3ee18be3b
Merge pull request #1026 from Doy-lee/LokiNameServiceWalletCleanup
Loki Name Service - Wallet parts
2020-02-17 10:42:26 +11:00
Doyle 6ddc247696 sqlite3_prepare_v3 prototype doesn't exist in some sql distributions 2020-02-14 17:06:44 +11:00
Jason Rhinelander 2315c60a3c SQLITE_PREPARE_PERSISTENT requires sqlite >= 3.20.0 2020-02-13 11:09:40 +11:00
Doyle 103f92a6a0 Resolve enabled mapping types via hf aware function instead of via enum 2020-02-13 11:07:47 +11:00
Doyle e10356430f Fix subtle bugs that crept in
- get_settings SQL was using get_owner_by_id query
- Settings row was queried sometimes by ID vs rowid
- Initialising DB against the checkpoint instead of the latest block
- Removing other LNS type references means needing to update the lns commands in CLI wallet
- wallet2 passing the value encoded in ascii into tx extra
2020-02-13 11:07:47 +11:00
Doyle e19b1b8b39 LNS: query owners by keys in a single sql query 2020-02-13 11:07:47 +11:00
Doyle 7c6cdaf4c2 Make get_mappings execute in a single query, s/user/owner 2020-02-13 11:07:47 +11:00
Doyle 8c69dd14ad Add register_height to the serialized members for LNS owners to name RPC 2020-02-13 11:07:47 +11:00
Doyle e3a6f20f85 Code review
- constexpr functions in common/loki.h for inlining
- move hex functions out from common/loki.h to common/hex.h
- use and apply prev_txid on LNS TX's to all LNS types (for updating in the future)
- add lns burn type, for custom burn amounts
- accept and validate lokinet addresses via base32z
- return lokinet addresses in RPC LNS calls via base32z
- updated Messenger references to Session
- update documentation to note that only Session LNS entries are allowed currently
- remove raw c-string interface from LNS db
- update multi-SQL queries into single SQL queries
- remove tx estimation backlog in anticipation for 2 priorities only, blink + unimportant
2020-02-13 11:07:47 +11:00
Doyle dafc95ac91 txid and prev_txid should be returning as a string in RPC 2020-02-13 11:07:47 +11:00
Doyle f460fc08ba Add a constructor for tx_extra_loki_name_system and use it 2020-02-13 11:07:47 +11:00
Doyle 528e41bec1 Cleanup pass 2 for github 2020-02-13 11:07:47 +11:00
Doyle 075c97b27f Expose the wallet public ed25519 key in on_get_address and address cmd 2020-02-13 11:07:46 +11:00
Doyle cf1d8adc67 Avoid serializing the prev_txid in LNS extra if not needed 2020-02-13 11:07:46 +11:00
Doyle 8d532e470a Scope the DB transaction around the settings table update as well 2020-02-13 11:07:46 +11:00
Doyle 42567b711c Support pop_blocks for LNS DB.
We allow arbitrary reorganizations for the LNS DB by storing the
previous TXID that purchased the LNS record. When reorganizing, we
iterate back through the blockchain looking for the first LNS entry that
is before the reorganize height and revert the LNS entry to that record.
2020-02-13 11:07:46 +11:00
Doyle c4a9c7ab20 Add txid/prev_txid into LNS db for rollbacks 2020-02-13 11:07:46 +11:00
Doyle e050b53c66 Ensure lns_value has sufficient size buffer, remove unused prototype 2020-02-13 11:07:46 +11:00
Doyle 394d587c2c Remove vendored SQLite, rely on system installed lib 2020-02-13 11:07:46 +11:00
Doyle cb579a1dec Robustify sql transactions, formalise LNS values maximums 2020-02-13 11:07:46 +11:00
Doyle 91d9783487 Turn plain enums into enum-struct in loki name system 2020-02-13 11:07:46 +11:00
Doyle 4e09eda234 Be consistent with identifier quoting in SQLite 2020-02-13 11:07:46 +11:00
Doyle a22157862b Update txtype activation hardforks 2020-02-13 11:07:46 +11:00
Doyle 41c51db583 Remove subsystems selection because we don't use it anymore 2020-02-13 11:07:46 +11:00
Doyle 70979fbeba Fix requirement to 30, and actually do the atomic step 2020-02-13 11:07:46 +11:00
Doyle 1093bab034 Send LNS values as blobs to the blockchain 2020-02-13 11:07:46 +11:00
Doyle cb955c1952 Fix travis CI complaint about mapping_type not declared 2020-02-13 11:07:46 +11:00
Doyle 2962e27400 Update LNS burn to 15 loki, add tests to check burns 2020-02-13 11:07:46 +11:00
Doyle a531f3fb90 Remove and undo some changes for github diffs 2020-02-13 11:07:46 +11:00
Doyle 9f3c97881e Force all incoming LNS txs to represent values as hex in the name->value mapping 2020-02-13 11:07:46 +11:00
Doyle cc2e65db49 Improve error messaging for LNS txes 2020-02-13 11:07:46 +11:00
Doyle 658db0c3f1 Add query LNS mappings to the CLI wallet 2020-02-13 11:07:46 +11:00
Doyle c7c32896fd Remove unused function rescan_starting_from_curr..
This has been combined into load_missing_blocks_into_loki_subsystem
which also handles loading blocks into LNS, but doesn't handle rescanning yet.
2020-02-13 11:07:46 +11:00
Doyle 632f6a6e83 Rebase fix, blink_lns -> blink, v15 and reserve types for protocol 2020-02-13 11:07:46 +11:00
Doyle 0b3df6c5ad Remove owner signature from loki name service tx extra
We want to allow people to buy LNS entries on behalf of other users. If
this is the case we don't need signatures to verify that the purchaser
knows the secret key. What we actually want in this scenario is that,
there's a LNS entry, and people can voluntarily pay to renew/buy that.
2020-02-13 11:07:46 +11:00
Doyle 766ea613ed Implement rpc, get_mappings_by_user 2020-02-13 11:07:46 +11:00
Doyle d0bcaef852 LNS rpc get_lns_[owner|name]_mapping, stub get_mappings_by_user 2020-02-13 11:07:46 +11:00
Doyle b78587c7b1 Handle duplicate LNS txs that are not checkpointed yet 2020-02-13 11:07:46 +11:00
Doyle 2a4009362e Remove extra LNS add_block call, incoporated into load_missing_blocks 2020-02-13 11:07:46 +11:00
Doyle 93f8bfb200 Fix rebase onto dev (blink) error 2020-02-13 11:07:46 +11:00
Doyle 6ef52ea940 Initialise DB from the immutable checkpoint height 2020-02-13 11:07:46 +11:00
Doyle 4340813d4b Check duplicate LNS entries via the name not the value 2020-02-13 11:07:46 +11:00
Doyle 7d259d47ff Verify LNS burn amounts and fix up tests to use burns 2020-02-13 11:07:46 +11:00
Doyle aedd3675e7 Add lokinet domain name validation 2020-02-13 11:07:46 +11:00
Doyle f17ed52182 Add buy lns rpc wallet, and wallet cli commands 2020-02-13 11:07:46 +11:00