libwallet: sign payment proofs with the key matching the addressed index#1
Draft
2ro wants to merge 1 commit into
Draft
libwallet: sign payment proofs with the key matching the addressed index#12ro wants to merge 1 commit into
2ro wants to merge 1 commit into
Conversation
The receive path created the payment-proof signature with the index-0 key regardless of which of the wallet's derived proof addresses the sender paid to, so a payment addressed to any non-zero derivation index failed the sender's finalize-time signature check (verify_slate_payment_proof). The new address::proof_address_derivation_index detects the addressed index (0 probed first — an ordinary receive costs one derivation exactly as before; scan bounded by MAX_PROOF_ADDRESS_INDEX = 1023) and receive_tx signs with the MATCHING key; an address outside the bound falls back to index 0, the old behavior. verify_payment_proof's is-this-mine test likewise now recognizes any derived address, not only index 0. Tests: minted indices derive pairwise-distinct addresses and map back to exactly their index (foreign addresses are never claimed); and the full round trip — mint at index 7, receive-side detection, proof signed with index 7's key — VERIFIES under the sender's finalize-time check while the old pinned index-0 signature FAILS it.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The receive path created the payment-proof signature with the index-0 key regardless of which of the wallet's derived proof addresses the sender paid to, so a payment addressed to any non-zero derivation index failed the sender's finalize-time signature check (verify_slate_payment_proof). The new address::proof_address_derivation_index detects the addressed index (0 probed first — an ordinary receive costs one derivation exactly as before; scan bounded by MAX_PROOF_ADDRESS_INDEX = 1023) and receive_tx signs with the MATCHING key; an address outside the bound falls back to index 0, the old behavior. verify_payment_proof's is-this-mine test likewise now recognizes any derived address, not only index 0.
Tests: minted indices derive pairwise-distinct addresses and map back to exactly their index (foreign addresses are never claimed); and the full round trip — mint at index 7, receive-side detection, proof signed with index 7's key — VERIFIES under the sender's finalize-time check while the old pinned index-0 signature FAILS it.