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

multi: Add CreateRevocationFromTicket. #2707

Merged
merged 2 commits into from Aug 27, 2021

Conversation

rstaudt2
Copy link
Member

This adds a new function, CreateRevocationFromTicket, and associated tests for creating a revocation transaction for a given ticket.

Additionally, it reworks the createrawssrtx rpcserver handler to use the CreateRevocationFromTicket function from the stake package rather than creating the transaction directly.

It also adds additional error handling on the transaction input:

  • The input must be a ticket submission output (output index 0)
  • The input amount must equal the ticket submission amount

This function will also be used from the mining template generation code to create revocations as part of the automatic ticket revocations agenda.

blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx_test.go Show resolved Hide resolved
@rstaudt2 rstaudt2 force-pushed the create-revocation-from-ticket branch 2 times, most recently from f8f44b5 to a9a2f64 Compare August 20, 2021 11:52
@rstaudt2 rstaudt2 force-pushed the create-revocation-from-ticket branch from a9a2f64 to 30f6a42 Compare August 25, 2021 13:39
Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

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

Also tried it out on simnet and was able to revoke a ticket.

blockchain/stake/staketx.go Outdated Show resolved Hide resolved
@rstaudt2 rstaudt2 force-pushed the create-revocation-from-ticket branch from 30f6a42 to 4a358b4 Compare August 26, 2021 11:14
blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx.go Outdated Show resolved Hide resolved
blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx.go Show resolved Hide resolved
blockchain/stake/staketx.go Show resolved Hide resolved
This adds a new function, CreateRevocationFromTicket, and associated
tests for creating a revocation transaction for a given ticket.
This reworks the createrawssrtx handler to use the
CreateRevocationFromTicket function from the stake package rather than
creating the transaction directly.

It also adds additional error handling on the transaction input:
  - The input must be a ticket submission output (output index 0)
  - The input amount must equal the ticket submission amount
@rstaudt2 rstaudt2 force-pushed the create-revocation-from-ticket branch from 4a358b4 to 98608fb Compare August 27, 2021 11:10
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

The updates look good now. The code in the RPC handler is much cleaner and the test additions to ensure proper creation of the revocation are nice to see.

@davecgh davecgh merged commit 08b7b89 into decred:master Aug 27, 2021
@rstaudt2 rstaudt2 deleted the create-revocation-from-ticket branch October 28, 2021 21:57
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.

None yet

4 participants