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: Remove deprecated missed and expired tickets RPCs. #2911

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c70926e
rpcserver: Bump version to 8.0.0.
davecgh Mar 27, 2022
201f266
docs: Remove missedtickets JSON-RPC API.
davecgh Mar 27, 2022
c692f44
rpcclient: Remove missedtickets.
davecgh Mar 27, 2022
b49e6e7
rpcserver: Remove missedtickets RPC.
davecgh Mar 27, 2022
61ff5e5
jsonrpc/types: Remove deprecated missedtickets.
davecgh Mar 27, 2022
1f7c6b2
docs: Remove rebroadcastmissed JSON-RPC API.
davecgh Mar 27, 2022
09d6eb2
rpcserver: Remove rebroadcastmissed RPC.
davecgh Mar 27, 2022
1636ed7
blockchain: Remove unused MissedTickets.
davecgh Mar 27, 2022
fffbae7
jsonrpc/types: Remove rebroadcastmissed.
davecgh Mar 27, 2022
77cbb2c
docs: Remove existsmissedtickets JSON-RPC API.
davecgh Mar 27, 2022
94f64ea
rpcclient: Remove existsmissedtickets.
davecgh Mar 27, 2022
e11174b
rpcserver: Remove existsmissedtickets RPC.
davecgh Mar 27, 2022
5e46f1e
blockchain: Remove unused CheckMissedTickets.
davecgh Mar 27, 2022
34b1eba
jsonrpc/types: Remove existsmissedtickets.
davecgh Mar 27, 2022
5f8936c
docs: Remove existsexpiredtickets JSON-RPC API.
davecgh Mar 27, 2022
c19282b
rpcclient: Remove existsexpiredtickets.
davecgh Mar 27, 2022
0ac6cbe
rpcserver: Remove existsexpiredtickets RPC.
davecgh Mar 27, 2022
e509a69
blockchain: Remove unused CheckExpiredTickets.
davecgh Mar 27, 2022
44226d3
jsonrpc/types: Remove existsexpiredtickets.
davecgh Mar 27, 2022
f13d03c
docs: Remove (notify)spentandmissed JSON-RPC API.
davecgh Mar 27, 2022
4521b76
rpcclient: Remove notifyspentandmissedtickets.
davecgh Mar 27, 2022
34924e8
rpcserver: Remove notifyspentandmissedtickets RPC.
davecgh Mar 27, 2022
4261708
blockchain: Remove unused NTSpentAndMissedTickets.
davecgh Mar 27, 2022
0969534
jsonrpc/types: Remove notifyspentandmissedtickets.
davecgh Mar 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,25 +818,12 @@ func (b *BlockChain) connectBlock(node *blockNode, block, parent *dcrutil.Block,
return err
}

// Notify of spent and missed tickets.
b.sendNotification(NTSpentAndMissedTickets,
&TicketNotificationsData{
Hash: node.hash,
Height: node.height,
StakeDifficulty: nextStakeDiff,
TicketsSpent: node.stakeNode.SpentByBlock(),
TicketsMissed: node.stakeNode.MissedByBlock(),
TicketsNew: nil,
})

// Notify of new tickets.
b.sendNotification(NTNewTickets,
&TicketNotificationsData{
Hash: node.hash,
Height: node.height,
StakeDifficulty: nextStakeDiff,
TicketsSpent: nil,
TicketsMissed: nil,
TicketsNew: node.stakeNode.NewTickets(),
})
}
Expand Down
28 changes: 10 additions & 18 deletions blockchain/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ const (
// place.
NTReorganization

// NTSpentAndMissedTickets indicates spent or missed tickets from a newly
// accepted block.
NTSpentAndMissedTickets

// NTNewTickets indicates newly maturing tickets from a newly accepted
// block.
NTNewTickets
Expand All @@ -78,15 +74,14 @@ const (
// notificationTypeStrings is a map of notification types back to their constant
// names for pretty printing.
var notificationTypeStrings = map[NotificationType]string{
NTNewTipBlockChecked: "NTNewTipBlockChecked",
NTBlockAccepted: "NTBlockAccepted",
NTBlockConnected: "NTBlockConnected",
NTBlockDisconnected: "NTBlockDisconnected",
NTChainReorgStarted: "NTChainReorgStarted",
NTChainReorgDone: "NTChainReorgDone",
NTReorganization: "NTReorganization",
NTSpentAndMissedTickets: "NTSpentAndMissedTickets",
NTNewTickets: "NTNewTickets",
NTNewTipBlockChecked: "NTNewTipBlockChecked",
NTBlockAccepted: "NTBlockAccepted",
NTBlockConnected: "NTBlockConnected",
NTBlockDisconnected: "NTBlockDisconnected",
NTChainReorgStarted: "NTChainReorgStarted",
NTChainReorgDone: "NTChainReorgDone",
NTReorganization: "NTReorganization",
NTNewTickets: "NTNewTickets",
}

// String returns the NotificationType in human-readable form.
Expand Down Expand Up @@ -166,14 +161,12 @@ type ReorganizationNtfnsData struct {
NewHeight int64
}

// TicketNotificationsData is the structure for new/spent/missed ticket
// notifications at blockchain HEAD that are outgoing from chain.
// TicketNotificationsData is the structure for data indicating information
// about new tickets in a connected block.
type TicketNotificationsData struct {
Hash chainhash.Hash
Height int64
StakeDifficulty int64
TicketsSpent []chainhash.Hash
TicketsMissed []chainhash.Hash
TicketsNew []chainhash.Hash
}

Expand All @@ -187,7 +180,6 @@ type TicketNotificationsData struct {
// - NTChainReorgStarted: nil
// - NTChainReorgDone: nil
// - NTReorganization: *ReorganizationNtfnsData
// - NTSpentAndMissedTickets: *TicketNotificationsData
// - NTNewTickets: *TicketNotificationsData
type Notification struct {
Type NotificationType
Expand Down
56 changes: 0 additions & 56 deletions blockchain/stakeext.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ func (b *BlockChain) LiveTickets() ([]chainhash.Hash, error) {
return sn.LiveTickets(), nil
}

// MissedTickets returns all currently missed tickets from the stake database.
//
// This function is safe for concurrent access.
func (b *BlockChain) MissedTickets() ([]chainhash.Hash, error) {
b.chainLock.RLock()
sn := b.bestChain.Tip().stakeNode
b.chainLock.RUnlock()

return sn.MissedTickets(), nil
}

// TicketsWithAddress returns a slice of ticket hashes that are currently live
// corresponding to the given address.
//
Expand Down Expand Up @@ -142,51 +131,6 @@ func (b *BlockChain) CheckLiveTickets(hashes []chainhash.Hash) []bool {
return existsSlice
}

// CheckMissedTickets returns a slice of bools representing whether each ticket
// hash has been missed in the live ticket treap of the best node.
//
// This function is safe for concurrent access.
func (b *BlockChain) CheckMissedTickets(hashes []chainhash.Hash) []bool {
b.chainLock.RLock()
sn := b.bestChain.Tip().stakeNode
b.chainLock.RUnlock()

existsSlice := make([]bool, len(hashes))
for i := range hashes {
existsSlice[i] = sn.ExistsMissedTicket(hashes[i])
}

return existsSlice
}

// CheckExpiredTicket returns whether or not a ticket was ever expired.
//
// This function is safe for concurrent access.
func (b *BlockChain) CheckExpiredTicket(hash chainhash.Hash) bool {
b.chainLock.RLock()
sn := b.bestChain.Tip().stakeNode
b.chainLock.RUnlock()

return sn.ExistsExpiredTicket(hash)
}

// CheckExpiredTickets returns whether or not a ticket in a slice of
// tickets was ever expired.
//
// This function is safe for concurrent access.
func (b *BlockChain) CheckExpiredTickets(hashes []chainhash.Hash) []bool {
b.chainLock.RLock()
sn := b.bestChain.Tip().stakeNode
b.chainLock.RUnlock()

existsSlice := make([]bool, len(hashes))
for i := range hashes {
existsSlice[i] = sn.ExistsExpiredTicket(hashes[i])
}

return existsSlice
}

// TicketPoolValue returns the current value of all the locked funds in the
// ticket pool.
//
Expand Down
150 changes: 0 additions & 150 deletions docs/json_rpc_api.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ the method name for further details such as parameter and return information.
|Y
|Returns the existence of the provided addresses.
|-
|[[#existsexpiredtickets|existsexpiredtickets]]
|Y
|Returns the existence of the provided tickets in the expired ticket map.
|-
|[[#existsliveticket|existsliveticket]]
|Y
|Returns the existence of the provided ticket.
Expand All @@ -184,10 +180,6 @@ the method name for further details such as parameter and return information.
|Y
|Returns the existence of the provided txs in the mempool.
|-
|[[#existsmissedtickets|existsmissedtickets]]
|Y
|Returns the existence of the provided tickets in the missed ticket map.
|-
|[[#generate|generate]]
|N
|When in simnet or regtest mode, generate a set number of blocks.
Expand Down Expand Up @@ -352,10 +344,6 @@ the method name for further details such as parameter and return information.
|Y
|Returns live ticket hashes from the ticket database.
|-
|[[#missedtickets|missedtickets]]
|Y
|Returns missed ticket hashes from the ticket database.
|-
|[[#node|node]]
|N
|Attempts to add or remove a peer.
Expand Down Expand Up @@ -823,28 +811,6 @@ the method name for further details such as parameter and return information.

----

====existsexpiredtickets====
{|
!Method
|existsexpiredtickets
|-
!Parameters
|
# <code>txhashes</code>: <code>(json array, required)</code> The array of tx hashes to check.
|-
!Description
|Returns the existence of the provided tickets in the expired ticket map.
|-
!Returns
|<code>bitset</code> Bitset of bools showing if tx hashes exist or not as expired tickets.
|-
!Example Return
|<code>00</code>
|}

----


====existsliveticket====
{|
!Method
Expand Down Expand Up @@ -908,27 +874,6 @@ the method name for further details such as parameter and return information.

----

====existsmissedtickets====
{|
!Method
|existsmissedtickets
|-
!Parameters
|
# <code>txhashes</code>: <code>(json array, required)</code> The array of tx hashes to check.
|-
!Description
|Returns the existence of the provided tickets in the missed ticket map.
|-
!Returns
|<code>bitset</code> Bitset of bools showing if tx hashes exist or not as missed tickets.
|-
!Example Return
|<code>00</code>
|}

----

====generate====
{|
!Method
Expand Down Expand Up @@ -2223,27 +2168,6 @@ of the best block.

----

====missedtickets====
{|
!Method
|missedtickets
|-
!Parameters
|None
|-
!Description
| Returns missed ticket hashes from the ticket database.
|-
!Returns
|<code>(json object)</code>
: <code>tickets</code>: <code>(json array)</code> List of missed tickets.
|-
!Example Return
|<code>{"tickets": ["f56cd8250ac399773bd0a5461587fd1512193476278c4e4b05efc3eca35ca3fe","071c140969f6d74b90e98df5713e07f83f246a92b4f13f365952b83e3922c6fe",...]}</code>
|}

----

====node====
{|
!Method
Expand Down Expand Up @@ -2712,10 +2636,6 @@ user. Click the method name for further details such as parameter and return in
|Load, add to, or reload a websocket client's transaction filter for mempool transactions, new blocks and rescanblocks.
|[[#relevanttxaccepted|relevanttxaccepted]]
|-
|[[#rebroadcastmissed|rebroadcastmissed]]
|Asks the daemon to rebroadcast missed votes.
|[[#spentandmissedtickets|spentandmissedtickets]]
|-
|[[#rebroadcastwinners|rebroadcastwinners]]
|Asks the daemon to rebroadcast the winners of the voting lottery.
|[[#winningtickets|winningtickets]]
Expand All @@ -2736,10 +2656,6 @@ user. Click the method name for further details such as parameter and return in
|Send notifications for all tickets that are chosen to vote.
|[[#winningtickets|winningtickets]]
|-
|[[#notifyspentandmissedtickets|notifyspentandmissedtickets]]
|Send notifications for all tickets that are spent or missed.
|[[#spentandmissedtickets|spentandmissedtickets]]
|-
|[[#notifynewtickets|notifynewtickets]]
|Send notifications for all new tickets that have matured.
|[[#newtickets|newtickets]]
Expand Down Expand Up @@ -3013,24 +2929,6 @@ NOTE: This is only required if an HTTP Authorization header is not being used.

----

====rebroadcastmissed====
{|
!Method
|rebroadcastmissed
|-
!Parameters
|None
|-
!Description
|Asks the daemon to rebroadcast missed votes via a [[#spentandmissedtickets|spentandmissedtickets]] notification.
|-
!Returns
|Nothing
|-
|}

----

====rebroadcastwinners====
{|
!Method
Expand Down Expand Up @@ -3140,26 +3038,6 @@ NOTE: This is only required if an HTTP Authorization header is not being used.

----

====notifyspentandmissedtickets====
{|
!Method
|notifyspentandmissedtickets
|-
!Notifications
|[[#spentandmissedtickets|spentandmissedtickets]]
|-
!Parameters
|None
|-
!Description
|Send a spentandmissedtickets notification when tickets are spent or missed.
|-
!Returns
|Nothing
|}

----

====notifynewtickets====
{|
!Method
Expand Down Expand Up @@ -3254,10 +3132,6 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
|Tickets were chosen to vote.
|[[#notifywinningtickets|notifywinningtickets]]
|-
|[[#spentandmissedtickets|spentandmissedtickets]]
|Tickets were spent or missed.
|[[#notifyspentandmissedtickets|notifyspentandmissedtickets]]
|-
|[[#newtickets|newtickets]]
|New tickets matured.
|[[#notifynewtickets|notifynewtickets]]
Expand Down Expand Up @@ -3504,30 +3378,6 @@ The redeemingtx notification for the same txout, after the spending transaction
|}
----

====spentandmissedtickets====
{|
!Method
|spentandmissedtickets
|-
!Request
|[[#notifyspentandmissedtickets|notifyspentandmissedtickets]]
|-
!Parameters
|
# <code>Hash</code>: <code>(string)</code> the hash of the block.
# <code>Height</code>: <code>(numeric)</code> the height of the block.
# <code>StakeDiff</code>: <code>(numeric)</code> the stake difficulty of the block.
# <code>Tickets</code>: <code>(object)</code> the tickets that have been spent or missed.
|-
!Description
|Notifies a client when tickets have been spent or missed.
|-
!Example
|Example spentandmissedtickets notification for block 479903 on testnet:
: <code>{"jsonrpc": "1.0", "method": "spentandmissedtickets", "params": ["00000044a6c0e2fb8f4feae2ac1133443859407abcf27d5d3a29d7d16eda8bc4", 479903, 9003800525, {"2911dbd36f0bf09e9e84d223b076413d34c39dea7a060c32e5271d0dbb64b332": "spent", "5edc39e2e5f2fccac6d3a10ae7b0cb51031472cc606d450bbf1d5680083f20a1": "spent", "67ec8b66c5bfc1277cc6c6fc00d1b9e9b1c4d61baed7774843ca86200876fe91": "spent", "c2ca81646dc7afb2165354bbe9fcbf8f3d1e97e4a8361934d43db8cdc7ffcdc0": "spent", "da5b300e1a05b9aad2323916cc4ec6eff98962fcb87787dbe24d25b8ea5b102c": "spent"}], "id": null}</code>
|}
----

====newtickets====
{|
!Method
Expand Down
Loading