forked from LBRYCommunity/lbry-sdk
move get_expiration_height and claimtrie constants to Coin class
This commit is contained in:
parent
86b6b860dc
commit
6aa124592d
2 changed files with 31 additions and 16 deletions
|
@ -261,6 +261,18 @@ class LBC(Coin):
|
||||||
TX_PER_BLOCK = 1
|
TX_PER_BLOCK = 1
|
||||||
RPC_PORT = 9245
|
RPC_PORT = 9245
|
||||||
REORG_LIMIT = 200
|
REORG_LIMIT = 200
|
||||||
|
|
||||||
|
nOriginalClaimExpirationTime = 262974
|
||||||
|
nExtendedClaimExpirationTime = 2102400
|
||||||
|
nExtendedClaimExpirationForkHeight = 400155
|
||||||
|
nNormalizedNameForkHeight = 539940 # targeting 21 March 2019
|
||||||
|
nMinTakeoverWorkaroundHeight = 496850
|
||||||
|
nMaxTakeoverWorkaroundHeight = 658300 # targeting 30 Oct 2019
|
||||||
|
nWitnessForkHeight = 680770 # targeting 11 Dec 2019
|
||||||
|
nAllClaimsInMerkleForkHeight = 658310 # targeting 30 Oct 2019
|
||||||
|
proportionalDelayFactor = 32
|
||||||
|
maxTakeoverDelay = 4032
|
||||||
|
|
||||||
PEERS = [
|
PEERS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -338,6 +350,16 @@ class LBC(Coin):
|
||||||
else:
|
else:
|
||||||
return sha256(script).digest()[:HASHX_LEN]
|
return sha256(script).digest()[:HASHX_LEN]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_expiration_height(cls, last_updated_height: int) -> int:
|
||||||
|
if last_updated_height < cls.nExtendedClaimExpirationForkHeight:
|
||||||
|
return last_updated_height + cls.nOriginalClaimExpirationTime
|
||||||
|
return last_updated_height + cls.nExtendedClaimExpirationTime
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_delay_for_name(cls, blocks_of_continuous_ownership: int) -> int:
|
||||||
|
return min(blocks_of_continuous_ownership // cls.proportionalDelayFactor, cls.maxTakeoverDelay)
|
||||||
|
|
||||||
|
|
||||||
class LBCRegTest(LBC):
|
class LBCRegTest(LBC):
|
||||||
NET = "regtest"
|
NET = "regtest"
|
||||||
|
@ -347,6 +369,15 @@ class LBCRegTest(LBC):
|
||||||
P2PKH_VERBYTE = bytes.fromhex("6f")
|
P2PKH_VERBYTE = bytes.fromhex("6f")
|
||||||
P2SH_VERBYTES = bytes.fromhex("c4")
|
P2SH_VERBYTES = bytes.fromhex("c4")
|
||||||
|
|
||||||
|
nOriginalClaimExpirationTime = 500
|
||||||
|
nExtendedClaimExpirationTime = 600
|
||||||
|
nExtendedClaimExpirationForkHeight = 800
|
||||||
|
nNormalizedNameForkHeight = 250
|
||||||
|
nMinTakeoverWorkaroundHeight = -1
|
||||||
|
nMaxTakeoverWorkaroundHeight = -1
|
||||||
|
nWitnessForkHeight = 150
|
||||||
|
nAllClaimsInMerkleForkHeight = 350
|
||||||
|
|
||||||
|
|
||||||
class LBCTestNet(LBCRegTest):
|
class LBCTestNet(LBCRegTest):
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
|
|
|
@ -4,26 +4,10 @@ from lbry.wallet.server.db.revertable import RevertablePut, RevertableDelete, Re
|
||||||
from lbry.wallet.server.db import DB_PREFIXES
|
from lbry.wallet.server.db import DB_PREFIXES
|
||||||
from lbry.wallet.server.db.prefixes import Prefixes, ClaimTakeoverValue
|
from lbry.wallet.server.db.prefixes import Prefixes, ClaimTakeoverValue
|
||||||
|
|
||||||
nOriginalClaimExpirationTime = 262974
|
|
||||||
nExtendedClaimExpirationTime = 2102400
|
|
||||||
nExtendedClaimExpirationForkHeight = 400155
|
|
||||||
nNormalizedNameForkHeight = 539940 # targeting 21 March 2019
|
|
||||||
nMinTakeoverWorkaroundHeight = 496850
|
|
||||||
nMaxTakeoverWorkaroundHeight = 658300 # targeting 30 Oct 2019
|
|
||||||
nWitnessForkHeight = 680770 # targeting 11 Dec 2019
|
|
||||||
nAllClaimsInMerkleForkHeight = 658310 # targeting 30 Oct 2019
|
|
||||||
proportionalDelayFactor = 32
|
|
||||||
maxTakeoverDelay = 4032
|
|
||||||
|
|
||||||
|
|
||||||
def get_delay_for_name(blocks_of_continuous_ownership: int) -> int:
|
|
||||||
return min(blocks_of_continuous_ownership // proportionalDelayFactor, maxTakeoverDelay)
|
|
||||||
|
|
||||||
|
|
||||||
def get_expiration_height(last_updated_height: int) -> int:
|
|
||||||
if last_updated_height < nExtendedClaimExpirationForkHeight:
|
|
||||||
return last_updated_height + nOriginalClaimExpirationTime
|
|
||||||
return last_updated_height + nExtendedClaimExpirationTime
|
|
||||||
|
|
||||||
|
|
||||||
def length_encoded_name(name: str) -> bytes:
|
def length_encoded_name(name: str) -> bytes:
|
||||||
|
|
Loading…
Reference in a new issue