aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/secp256k1/secp256.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-11-27 22:40:29 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-02-18 17:08:11 +0800
commit371871d685d54b916aef28de689d6f0af7822083 (patch)
treee704b02ba2ffd2d1164001885fba15106b0f7d94 /crypto/secp256k1/secp256.go
parentaa36a6ae4f24f07e2c470a21c93ff37ad5861982 (diff)
downloadgo-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar.gz
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar.bz2
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar.lz
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar.xz
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.tar.zst
go-tangerine-371871d685d54b916aef28de689d6f0af7822083.zip
parmas, crypto, core, core/vm: homestead consensus protocol changes
* change gas cost for contract creating txs * invalidate signature with s value greater than secp256k1 N / 2 * OOG contract creation if not enough gas to store code * new difficulty adjustment algorithm * new DELEGATECALL op code
Diffstat (limited to 'crypto/secp256k1/secp256.go')
-rw-r--r--crypto/secp256k1/secp256.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go
index 97b4bd8da..4999c5c95 100644
--- a/crypto/secp256k1/secp256.go
+++ b/crypto/secp256k1/secp256.go
@@ -58,10 +58,14 @@ import (
var (
context *C.secp256k1_context
N *big.Int
+ HalfN *big.Int
)
func init() {
N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16)
+ // N / 2 == 57896044618658097711785492504343953926418782139537452191302581570759080747168
+ HalfN, _ = new(big.Int).SetString("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0", 16)
+
// around 20 ms on a modern CPU.
context = C.secp256k1_context_create(3) // SECP256K1_START_SIGN | SECP256K1_START_VERIFY
C.secp256k1_context_set_illegal_callback(context, C.callbackFunc(C.secp256k1GoPanicIllegal), nil)