diff --git a/Dockerfile b/Dockerfile index 6c105e91..24721308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,12 +28,14 @@ COPY backend/countries countries COPY backend/main.go . # include core src -COPY core/bls ../core/bls -COPY core/cmd ../core/cmd -COPY core/desohash ../core/desohash -COPY core/lib ../core/lib -COPY core/migrate ../core/migrate -COPY core/scripts ../core/scripts +COPY core/bls ../core/bls +COPY core/cmd ../core/cmd +COPY core/collections ../core/collections +COPY core/consensus ../core/consensus +COPY core/desohash ../core/desohash +COPY core/lib ../core/lib +COPY core/migrate ../core/migrate +COPY core/scripts ../core/scripts RUN ../core/scripts/install-relic.sh diff --git a/go.mod b/go.mod index b4b79c8d..1c351627 100644 --- a/go.mod +++ b/go.mod @@ -53,6 +53,7 @@ require ( github.com/deso-protocol/go-merkle-tree v1.0.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dustin/go-humanize v1.0.0 // indirect + github.com/emirpasic/gods v1.18.1 // indirect github.com/ethereum/go-ethereum v1.9.25 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect diff --git a/go.sum b/go.sum index 3dbb5e5e..75f51c55 100644 --- a/go.sum +++ b/go.sum @@ -164,6 +164,8 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= diff --git a/routes/admin_node.go b/routes/admin_node.go index f1ebc32f..473c26dd 100644 --- a/routes/admin_node.go +++ b/routes/admin_node.go @@ -109,13 +109,13 @@ func (fes *APIServer) _handleNodeControlGetInfo( { desoNodeStatus.LatestHeaderHeight = desoHeaderTip.Height desoNodeStatus.LatestHeaderHash = hex.EncodeToString(desoHeaderTip.Hash[:]) - desoNodeStatus.LatestHeaderTstampSecs = uint32(desoHeaderTip.Header.TstampSecs) + desoNodeStatus.LatestHeaderTstampSecs = uint32(desoHeaderTip.Header.GetTstampSecs()) } // Main block chain fields { desoNodeStatus.LatestBlockHeight = desoBlockTip.Height desoNodeStatus.LatestBlockHash = hex.EncodeToString(desoBlockTip.Hash[:]) - desoNodeStatus.LatestBlockTstampSecs = uint32(desoBlockTip.Header.TstampSecs) + desoNodeStatus.LatestBlockTstampSecs = uint32(desoBlockTip.Header.GetTstampSecs()) } if fes.TXIndex != nil { // TxIndex status diff --git a/routes/exchange.go b/routes/exchange.go index 89eba7f5..30f54311 100644 --- a/routes/exchange.go +++ b/routes/exchange.go @@ -132,7 +132,7 @@ func _headerToResponse(header *lib.MsgDeSoHeader, hash string) *HeaderResponse { Version: header.Version, PrevBlockHashHex: header.PrevBlockHash.String(), TransactionMerkleRootHex: header.TransactionMerkleRoot.String(), - TstampSecs: header.TstampSecs, + TstampSecs: header.GetTstampSecs(), Height: header.Height, Nonce: header.Nonce, ExtraNonce: header.ExtraNonce, @@ -666,7 +666,7 @@ func APITransactionToResponse( if block != nil && block.Header != nil { ret.BlockInfo = &TransactionBlockInfo{ Height: block.Header.Height, - TimestampSecs: block.Header.TstampSecs, + TimestampSecs: block.Header.GetTstampSecs(), } } diff --git a/routes/exchange_test.go b/routes/exchange_test.go index 663ce57c..1f1a0bdc 100644 --- a/routes/exchange_test.go +++ b/routes/exchange_test.go @@ -103,7 +103,6 @@ func NewLowDifficultyBlockchainWithParams(t *testing.T, params *lib.DeSoParams) Version: 0, PrevBlockHash: lib.MustDecodeHexBlockHash("0000000000000000000000000000000000000000000000000000000000000000"), TransactionMerkleRoot: lib.MustDecodeHexBlockHash("097158f0d27e6d10565c4dc696c784652c3380e0ff8382d3599a4d18b782e965"), - TstampSecs: uint64(1560735050), Height: uint64(0), Nonce: uint64(0), // No ExtraNonce is set in the genesis block @@ -120,6 +119,7 @@ func NewLowDifficultyBlockchainWithParams(t *testing.T, params *lib.DeSoParams) }, }, } + paramsCopy.GenesisBlock.Header.SetTstampSecs(uint64(1560735050)) paramsCopy.MinDifficultyTargetHex = "999999948931e5874cf66a74c0fda790dd8c7458243d400324511a4c71f54faa" paramsCopy.MinChainWorkHex = "0000000000000000000000000000000000000000000000000000000000000000" paramsCopy.MiningIterationsPerCycle = 500 @@ -157,7 +157,7 @@ func NewTestMiner(t *testing.T, chain *lib.Blockchain, params *lib.DeSoParams, i mempool := lib.NewDeSoMempool( chain, 0, /* rateLimitFeeRateNanosPerKB */ 0 /* minFeeRateNanosPerKB */, "", true, - "" /*dataDir*/, "") + "" /*dataDir*/, "", true) minerPubKeys := []string{} if isSender { minerPubKeys = append(minerPubKeys, senderPkString) diff --git a/routes/miner.go b/routes/miner.go index 4f046bc9..752b5655 100644 --- a/routes/miner.go +++ b/routes/miner.go @@ -187,7 +187,7 @@ func (fes *APIServer) SubmitBlock(ww http.ResponseWriter, req *http.Request) { // TODO: Signature checking slows things down because it acquires the ChainLock. // The optimal solution is to check signatures in a way that doesn't acquire the // ChainLock, which is what Bitcoin Core does. - isMainChain, isOrphan, err := fes.blockchain.ProcessBlock( + isMainChain, isOrphan, _, err := fes.blockchain.ProcessBlock( blockFound, true /*verifySignatures*/) glog.V(1).Infof("Called ProcessBlock: isMainChain=(%v), isOrphan=(%v), err=(%v)", isMainChain, isOrphan, err) diff --git a/routes/transaction.go b/routes/transaction.go index 43ee242a..6405f370 100644 --- a/routes/transaction.go +++ b/routes/transaction.go @@ -3953,6 +3953,7 @@ func (fes *APIServer) simulateSubmitTransaction(utxoView *lib.UtxoView, txn *lib txn.Hash(), 0, bestHeight, + 0, false, false, ) diff --git a/test.Dockerfile b/test.Dockerfile index a1ed5cd2..5e2233f5 100644 --- a/test.Dockerfile +++ b/test.Dockerfile @@ -16,7 +16,11 @@ RUN git pull && \ git checkout feature/proof-of-stake && \ git pull origin feature/proof-of-stake # TODO: Revert to `git pull` once core PR is merged. +# Try to checkout to the specified branch. If it fails, checkout main. +RUN (git checkout ${BRANCH_NAME} && git pull origin ${BRANCH_NAME}) || (echo "Branch ${BRANCH_NAME} not found. Falling back to feature/proof-of-stake." && git checkout feature/proof-of-stake) + RUN go mod download + RUN ./scripts/install-relic.sh WORKDIR /deso/src/backend