Skip to content

Commit

Permalink
Fix: Binary Maths (#82)
Browse files Browse the repository at this point in the history
* move max num length to config library

* getting there

* its working lol

* cleaned up pr

* more cleaning

* fixed linter

* began scriptnum removal

* rewrite scriptnumber entirely

* use afterGenesis flag

* more cleanups

* purged all refs to makeScriptNum

* even more cleanups

* shortened some code

* made the shifts on big.Int clearer with comments
  • Loading branch information
tigh-latte authored Nov 16, 2021
1 parent 4f458d2 commit 55823e4
Show file tree
Hide file tree
Showing 9 changed files with 666 additions and 364 deletions.
9 changes: 9 additions & 0 deletions bscript/interpreter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package interpreter
import "math"

type config interface {
AfterGenesis() bool
MaxOps() int
MaxStackSize() int
MaxScriptSize() int
Expand All @@ -24,6 +25,14 @@ const (
type beforeGenesisConfig struct{}
type afterGenesisConfig struct{}

func (a *afterGenesisConfig) AfterGenesis() bool {
return true
}

func (b *beforeGenesisConfig) AfterGenesis() bool {
return false
}

func (a *afterGenesisConfig) MaxStackSize() int {
return math.MaxInt32
}
Expand Down
Loading

0 comments on commit 55823e4

Please sign in to comment.