Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in latest dcrd version. #429

Merged
merged 1 commit into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions rpc/legacyrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -2500,7 +2500,7 @@ func sendToMultiSig(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCCl
}

result := &dcrjson.SendToMultiSigResult{
TxHash: ctx.MsgTx.TxSha().String(),
TxHash: ctx.MsgTx.TxHash().String(),
Address: addr.EncodeAddress(),
RedeemScript: hex.EncodeToString(script),
}
Expand All @@ -2511,7 +2511,7 @@ func sendToMultiSig(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCCl
}

log.Infof("Successfully sent funds to multisignature output in "+
"transaction %v", ctx.MsgTx.TxSha().String())
"transaction %v", ctx.MsgTx.TxHash().String())

return result, nil
}
Expand Down Expand Up @@ -2618,10 +2618,10 @@ func sendToSSGen(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
}
}

txSha := createdTx.MsgTx.TxSha()
txHash := createdTx.MsgTx.TxHash()

log.Infof("Successfully sent transaction %v", txSha)
return txSha.String(), nil
log.Infof("Successfully sent transaction %v", txHash)
return txHash.String(), nil
}

// sendToSSRtx handles a sendtossrtx RPC request by creating a new transaction
Expand Down Expand Up @@ -2817,7 +2817,7 @@ func signMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
var buf bytes.Buffer
wire.WriteVarString(&buf, 0, "Decred Signed Message:\n")
wire.WriteVarString(&buf, 0, cmd.Message)
messageHash := chainhash.HashFuncB(buf.Bytes())
messageHash := chainhash.HashB(buf.Bytes())
pkCast, ok := privKey.(*secp256k1.PrivateKey)
if !ok {
return nil, fmt.Errorf("Unable to create secp256k1.PrivateKey" +
Expand Down Expand Up @@ -3282,7 +3282,7 @@ func verifyMessage(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
var buf bytes.Buffer
wire.WriteVarString(&buf, 0, "Decred Signed Message:\n")
wire.WriteVarString(&buf, 0, cmd.Message)
expectedMessageHash := chainhash.HashFuncB(buf.Bytes())
expectedMessageHash := chainhash.HashB(buf.Bytes())
pk, wasCompressed, err := chainec.Secp256k1.RecoverCompact(sig,
expectedMessageHash)
if err != nil {
Expand Down
22 changes: 10 additions & 12 deletions rpctest/rpcharness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package rpctest

import (
"bytes"
"encoding/hex"
"flag"
"fmt"
Expand Down Expand Up @@ -929,9 +928,9 @@ func testSendToAddress(r *Harness, t *testing.T) {
}
// Confirm that the expected tx was mined into the block.
minedTx := block.Transactions()[1]
txSha := minedTx.Sha()
if !bytes.Equal(txid[:], txSha.Bytes()[:]) {
t.Fatalf("txid's don't match, %v vs %v", txSha, txid)
txHash := minedTx.Hash()
if *txid != *txHash {
t.Fatalf("txid's don't match, %v vs %v", txHash, txid)
}

// We should now check to confirm that the utxo that wallet used to create
Expand Down Expand Up @@ -1038,10 +1037,10 @@ func testSendFrom(r *Harness, t *testing.T) {
t.Fatalf("expected transaction not included in block")
}
minedTx := block.Transactions()[1]
txSha := minedTx.Sha()
if !bytes.Equal(txid[:], txSha.Bytes()[:]) {
txHash := minedTx.Hash()
if *txid != *txHash {
t.Fatalf("txid's don't match, %v vs. %v (actual vs. expected)",
txSha, txid)
txHash, txid)
}

// Generate another block, since it takes 2 blocks to validate a tx
Expand Down Expand Up @@ -2693,9 +2692,8 @@ func includesTx(txHash *chainhash.Hash, block *dcrutil.Block,
blockTxs := block.Transactions()

for _, minedTx := range blockTxs {
txSha := minedTx.Sha()
//if bytes.Equal(txHash[:], txSha.Bytes()[:]) {
if txHash.IsEqual(txSha) {
minedTxHash := minedTx.Hash()
if *txHash == *minedTxHash {
return true
}
}
Expand All @@ -2714,8 +2712,8 @@ func includesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block,
blockTxs := block.STransactions()

for _, minedTx := range blockTxs {
txSha := minedTx.Sha()
if txHash.IsEqual(txSha) {
minedTxHash := minedTx.Hash()
if *txHash == *minedTxHash {
return true
}
}
Expand Down
10 changes: 5 additions & 5 deletions wallet/chainntfns.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (w *Wallet) onBlockConnected(dbtx walletdb.ReadWriteTx, serializedBlockHead
if err != nil {
return err
}
block := wtxmgr.BlockHeaderData{BlockHash: blockHeader.BlockSha()}
block := wtxmgr.BlockHeaderData{BlockHash: blockHeader.BlockHash()}
err = copyHeaderSliceToArray(&block.SerializedHeader, serializedBlockHeader)
if err != nil {
return err
Expand Down Expand Up @@ -416,20 +416,20 @@ func (w *Wallet) evaluateStakePoolTicket(rec *wtxmgr.TxRecord,
"has less fees than are required to use this "+
"stake pool and is being skipped (required: %v"+
", found %v)", commitAddr.EncodeAddress(),
tx.TxSha(), feeNeeded, commitAmt)
tx.TxHash(), feeNeeded, commitAmt)

// Reject the entire transaction if it didn't
// pay the pool server fees.
return false, nil
}
} else {
log.Warnf("Unknown pool commitment address %s for ticket %v",
commitAddr.EncodeAddress(), tx.TxSha())
commitAddr.EncodeAddress(), tx.TxHash())
return false, nil
}

log.Debugf("Accepted valid stake pool ticket %v committing %v in fees",
tx.TxSha(), tx.TxOut[0].Value)
tx.TxHash(), tx.TxOut[0].Value)

return true, nil
}
Expand Down Expand Up @@ -534,7 +534,7 @@ func (w *Wallet) processTransaction(dbtx walletdb.ReadWriteTx, serializedTx []by
err := w.StakeMgr.InsertSStx(stakemgrNs, tx, w.VoteBits)
if err != nil {
log.Errorf("Failed to insert SStx %v"+
"into the stake store.", tx.Sha())
"into the stake store.", tx.Hash())
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions wallet/createtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ func (w *Wallet) purchaseTicketsInternal(dbtx walletdb.ReadWriteTx, req purchase

eop = &extendedOutPoint{
op: &wire.OutPoint{
Hash: splitTx.Tx.TxSha(),
Hash: splitTx.Tx.TxHash(),
Index: uint32(i),
Tree: wire.TxTreeRegular,
},
Expand All @@ -1213,7 +1213,7 @@ func (w *Wallet) purchaseTicketsInternal(dbtx walletdb.ReadWriteTx, req purchase

eopPool = &extendedOutPoint{
op: &wire.OutPoint{
Hash: splitTx.Tx.TxSha(),
Hash: splitTx.Tx.TxHash(),
Index: uint32(poolIdx),
Tree: wire.TxTreeRegular,
},
Expand All @@ -1222,7 +1222,7 @@ func (w *Wallet) purchaseTicketsInternal(dbtx walletdb.ReadWriteTx, req purchase
}
eop = &extendedOutPoint{
op: &wire.OutPoint{
Hash: splitTx.Tx.TxSha(),
Hash: splitTx.Tx.TxHash(),
Index: uint32(userIdx),
Tree: wire.TxTreeRegular,
},
Expand Down Expand Up @@ -1293,7 +1293,7 @@ func (w *Wallet) purchaseTicketsInternal(dbtx walletdb.ReadWriteTx, req purchase
}

// Send the ticket over the network.
txSha, err := chainClient.SendRawTransaction(ticket, w.AllowHighFees)
txHash, err := chainClient.SendRawTransaction(ticket, w.AllowHighFees)
if err != nil {
return nil, err
}
Expand All @@ -1318,13 +1318,13 @@ func (w *Wallet) purchaseTicketsInternal(dbtx walletdb.ReadWriteTx, req purchase
err = w.StakeMgr.InsertSStx(stakemgrNs, txTemp, w.VoteBits)
if err != nil {
return nil, fmt.Errorf("Failed to insert SStx %v"+
"into the stake store", txTemp.Sha())
"into the stake store", txTemp.Hash())
}
}
}

log.Infof("Successfully sent SStx purchase transaction %v", txSha)
ticketHashes[i] = txSha
log.Infof("Successfully sent SStx purchase transaction %v", txHash)
ticketHashes[i] = txHash
}

return ticketHashes, nil
Expand Down
2 changes: 1 addition & 1 deletion wallet/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (w *Wallet) AddTicket(ticket *dcrutil.Tx) error {
return err
}

ticketHash := ticket.MsgTx().TxSha()
ticketHash := ticket.MsgTx().TxHash()

chainClient, err := w.requireChainClient()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion wallet/txrules/poolfees.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func StakePoolTicketFee(stakeDiff dcrutil.Amount, relayFee dcrutil.Amount,
// ceiling of the ticket pool size divided by the
// reduction interval.
adjs := int(math.Ceil(float64(params.TicketPoolSize) /
float64(params.ReductionInterval)))
float64(params.SubsidyReductionInterval)))
initSubsidyCacheOnce.Do(func() {
subsidyCache = blockchain.NewSubsidyCache(int64(height), params)
})
Expand Down
6 changes: 3 additions & 3 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func createHeaderData(headers []string) ([]wtxmgr.BlockHeaderData, error) {
if err != nil {
return nil, err
}
headerData.BlockHash = decodedHeader.BlockSha()
headerData.BlockHash = decodedHeader.BlockHash()
data[i] = headerData
}
return data, nil
Expand Down Expand Up @@ -3114,7 +3114,7 @@ func (w *Wallet) resendUnminedTxs() {
// TODO(jrick): Check error for if this tx is a double spend,
// remove it if so.
log.Tracef("Could not resend transaction %v: %v",
tx.TxSha(), err)
tx.TxHash(), err)
continue
}
log.Tracef("Resent unmined transaction %v", resp)
Expand Down Expand Up @@ -3302,7 +3302,7 @@ func (w *Wallet) SendOutputs(outputs []*wire.TxOut, account uint32,

// TODO: The record already has the serialized tx, so no need to
// serialize it again.
hash := createdTx.Tx.TxSha()
hash := createdTx.Tx.TxHash()
return &hash, nil
}

Expand Down
Loading