Skip to content

Instantly share code, notes, and snippets.

@mgraczyk

mgraczyk/perlin6.go

Created Jun 28, 2018
Embed
What would you like to do?
func (n *Node) OnReceiveTx(tx *Transaction) bool {
// ... Verify tx
// [OT] Take a global read lock.
mutex.Lock()
defer mutex.Unlock()
// [OT] Line 9
if _, received := n.Transactions[tx.Id]; !received {
// [OT] Line 10
if set, exists := n.Conflicts[tx.Body.Utxo]; exists {
set.Transactions[tx.Id] = tx // [OT] Line 13
} else {
// [OT] Lines 11/12
n.Conflicts[tx.Body.Utxo] = CreateConflictSet(tx)
}
// [OT] Line 14
n.Transactions[tx.Id] = tx
n.Chits[tx.Id] = 0
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.