Class: Sigma::NipopowVerifier
- Inherits:
-
Object
- Object
- Sigma::NipopowVerifier
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/nipopow.rb
Overview
A verifier for PoPoW proofs. During its lifetime, it processes many proofs with the aim of deducing at any given point what is the best (sub)chain rooted at the specified genesis.
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create(genesis_block_id) ⇒ NipopowVerifier
Create new instance.
Instance Method Summary collapse
-
#best_chain ⇒ BlockHeaders
Returns chain of ‘BlockHeader`s from the best proof.
-
#process(proof) ⇒ Object
Process given proof.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
73 74 75 |
# File 'lib/sigma/nipopow.rb', line 73 def pointer @pointer end |
Class Method Details
.create(genesis_block_id) ⇒ NipopowVerifier
Create new instance
78 79 80 81 82 |
# File 'lib/sigma/nipopow.rb', line 78 def self.create(genesis_block_id) pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_nipopow_verifier_new(genesis_block_id.pointer, pointer) init(pointer) end |
Instance Method Details
#best_chain ⇒ BlockHeaders
Returns chain of ‘BlockHeader`s from the best proof.
86 87 88 89 90 |
# File 'lib/sigma/nipopow.rb', line 86 def best_chain pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_nipopow_verifier_best_chain(self.pointer, pointer) BlockHeaders.with_raw_pointer(pointer) end |
#process(proof) ⇒ Object
Process given proof
94 95 96 97 |
# File 'lib/sigma/nipopow.rb', line 94 def process(proof) error = ergo_lib_nipopow_verifier_process(self.pointer, proof.pointer) Util.check_error!(error) end |