Skip to content
Permalink
Browse files

Merge branch 'upstream-master' into sigma

  • Loading branch information...
thebevrishot committed Jul 19, 2019
2 parents f95d21e + 8b9fe50 commit 08ccd065c93bf5c75df2ff65efb380a28a9b5922
Showing with 2,411 additions and 138 deletions.
  1. +89 −4 Gopkg.lock
  2. +12 −12 api/types.go
  3. +28 −28 api/typesv1.go
  4. +7 −7 api/worker.go
  5. +1 −2 api/xpub.go
  6. +3 −0 bchain/coins/blockchain.go
  7. +231 −0 bchain/coins/dcr/decredparser.go
  8. +238 −0 bchain/coins/dcr/decredparser_test.go
  9. +882 −0 bchain/coins/dcr/decredrpc.go
  10. +14 −0 bchain/coins/qtum/qtumrpc.go
  11. +1 −1 build/docker/deb/build-deb.sh
  12. +1 −1 build/templates/blockbook/logrotate.sh
  13. +1 −1 build/text/about
  14. +1 −1 build/tools/image_status.sh
  15. +4 −4 configs/coins/bcash.json
  16. +6 −6 configs/coins/bcash_testnet.json
  17. +4 −4 configs/coins/dash.json
  18. +4 −4 configs/coins/dash_testnet.json
  19. +68 −0 configs/coins/decred.json
  20. +68 −0 configs/coins/decred_testnet.json
  21. +3 −3 configs/coins/dogecoin.json
  22. +4 −4 configs/coins/monacoin.json
  23. +3 −3 configs/coins/monacoin_testnet.json
  24. +3 −3 configs/coins/qtum.json
  25. +3 −3 configs/coins/qtum_testnet.json
  26. +3 −3 configs/coins/ravencoin.json
  27. +3 −3 configs/coins/zelcash.json
  28. +1 −1 contrib/scripts/backend-deploy-and-test.sh
  29. +1 −1 contrib/scripts/build-blockchaincfg.sh
  30. +1 −1 contrib/scripts/deploy-dev.sh
  31. +1 −1 contrib/scripts/start-backend-tunnels.sh
  32. +23 −9 docs/api.md
  33. +2 −0 docs/ports.md
  34. +30 −17 server/public_test.go
  35. +2 −1 server/websocket.go
  36. +6 −6 static/templates/base.html
  37. +2 −2 static/templates/txdetail.html
  38. +2 −2 static/templates/txdetail_ethereumtype.html
  39. +1 −0 static/test-websocket.html
  40. +98 −0 tests/rpc/testdata/decred.json
  41. +115 −0 tests/rpc/testdata/decred_testnet.json
  42. +217 −0 tests/sync/testdata/decred.json
  43. +214 −0 tests/sync/testdata/decred_testnet.json
  44. +10 −0 tests/tests.json

Some generated files are not rendered by default. Learn more.

@@ -101,17 +101,17 @@ func (a *Amount) AsInt64() int64 {

// Vin contains information about single transaction input
type Vin struct {
Txid string `json:"txid,omitempty"`
Vout uint32 `json:"vout,omitempty"`
Sequence int64 `json:"sequence,omitempty"`
N int `json:"n"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses,omitempty"`
Searchable bool `json:"-"`
ValueSat *Amount `json:"value,omitempty"`
Hex string `json:"hex,omitempty"`
Asm string `json:"asm,omitempty"`
Coinbase string `json:"coinbase,omitempty"`
Txid string `json:"txid,omitempty"`
Vout uint32 `json:"vout,omitempty"`
Sequence int64 `json:"sequence,omitempty"`
N int `json:"n"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses,omitempty"`
IsAddress bool `json:"isAddress"`
ValueSat *Amount `json:"value,omitempty"`
Hex string `json:"hex,omitempty"`
Asm string `json:"asm,omitempty"`
Coinbase string `json:"coinbase,omitempty"`
}

// Vout contains information about single transaction output
@@ -126,7 +126,7 @@ type Vout struct {
Asm string `json:"asm,omitempty"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses"`
Searchable bool `json:"-"`
IsAddress bool `json:"isAddress"`
Type string `json:"type,omitempty"`
}

@@ -13,26 +13,26 @@ type ScriptSigV1 struct {

// VinV1 is used for legacy api v1
type VinV1 struct {
Txid string `json:"txid"`
Vout uint32 `json:"vout"`
Sequence int64 `json:"sequence,omitempty"`
N int `json:"n"`
ScriptSig ScriptSigV1 `json:"scriptSig"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses"`
Searchable bool `json:"-"`
Value string `json:"value"`
ValueSat big.Int `json:"-"`
Txid string `json:"txid"`
Vout uint32 `json:"vout"`
Sequence int64 `json:"sequence,omitempty"`
N int `json:"n"`
ScriptSig ScriptSigV1 `json:"scriptSig"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses"`
IsAddress bool `json:"-"`
Value string `json:"value"`
ValueSat big.Int `json:"-"`
}

// ScriptPubKeyV1 is used for legacy api v1
type ScriptPubKeyV1 struct {
Hex string `json:"hex,omitempty"`
Asm string `json:"asm,omitempty"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses"`
Searchable bool `json:"-"`
Type string `json:"type,omitempty"`
Hex string `json:"hex,omitempty"`
Asm string `json:"asm,omitempty"`
AddrDesc bchain.AddressDescriptor `json:"-"`
Addresses []string `json:"addresses"`
IsAddress bool `json:"-"`
Type string `json:"type,omitempty"`
}

// VoutV1 is used for legacy api v1
@@ -115,12 +115,12 @@ func (w *Worker) TxToV1(tx *Tx) *TxV1 {
Asm: v.Asm,
Hex: v.Hex,
},
Searchable: v.Searchable,
Sequence: v.Sequence,
Txid: v.Txid,
Value: v.ValueSat.DecimalString(d),
ValueSat: v.ValueSat.AsBigInt(),
Vout: v.Vout,
IsAddress: v.IsAddress,
Sequence: v.Sequence,
Txid: v.Txid,
Value: v.ValueSat.DecimalString(d),
ValueSat: v.ValueSat.AsBigInt(),
Vout: v.Vout,
}
}
voutV1 := make([]VoutV1, len(tx.Vout))
@@ -129,12 +129,12 @@ func (w *Worker) TxToV1(tx *Tx) *TxV1 {
voutV1[i] = VoutV1{
N: v.N,
ScriptPubKey: ScriptPubKeyV1{
AddrDesc: v.AddrDesc,
Addresses: v.Addresses,
Asm: v.Asm,
Hex: v.Hex,
Searchable: v.Searchable,
Type: v.Type,
AddrDesc: v.AddrDesc,
Addresses: v.Addresses,
Asm: v.Asm,
Hex: v.Hex,
IsAddress: v.IsAddress,
Type: v.Type,
},
Spent: v.Spent,
SpentHeight: v.SpentHeight,
@@ -166,7 +166,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height uint32,
if err == bchain.ErrTxNotFound {
// try to get AddrDesc using coin specific handling and continue processing the tx
vin.AddrDesc = w.chainParser.GetAddrDescForUnknownInput(bchainTx, i)
vin.Addresses, vin.Searchable, err = w.chainParser.GetAddressesFromAddrDesc(vin.AddrDesc)
vin.Addresses, vin.IsAddress, err = w.chainParser.GetAddressesFromAddrDesc(vin.AddrDesc)
if err != nil {
glog.Warning("GetAddressesFromAddrDesc tx ", bchainVin.Txid, ", addrDesc ", vin.AddrDesc, ": ", err)
}
@@ -185,7 +185,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height uint32,
if len(otx.Vout) > int(vin.Vout) {
vout := &otx.Vout[vin.Vout]
vin.ValueSat = (*Amount)(&vout.ValueSat)
vin.AddrDesc, vin.Addresses, vin.Searchable, err = w.getAddressesFromVout(vout)
vin.AddrDesc, vin.Addresses, vin.IsAddress, err = w.getAddressesFromVout(vout)
if err != nil {
glog.Errorf("getAddressesFromVout error %v, vout %+v", err, vout)
}
@@ -195,7 +195,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height uint32,
output := &tas.Outputs[vin.Vout]
vin.ValueSat = (*Amount)(&output.ValueSat)
vin.AddrDesc = output.AddrDesc
vin.Addresses, vin.Searchable, err = output.Addresses(w.chainParser)
vin.Addresses, vin.IsAddress, err = output.Addresses(w.chainParser)
if err != nil {
glog.Errorf("output.Addresses error %v, tx %v, output %v", err, bchainVin.Txid, i)
}
@@ -212,7 +212,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height uint32,
glog.Errorf("GetAddrDescFromAddress error %v, tx %v, bchainVin %v", err, bchainTx.Txid, bchainVin)
}
vin.Addresses = bchainVin.Addresses
vin.Searchable = true
vin.IsAddress = true
}
}
}
@@ -224,7 +224,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height uint32,
vout.ValueSat = (*Amount)(&bchainVout.ValueSat)
valOutSat.Add(&valOutSat, &bchainVout.ValueSat)
vout.Hex = bchainVout.ScriptPubKey.Hex
vout.AddrDesc, vout.Addresses, vout.Searchable, err = w.getAddressesFromVout(bchainVout)
vout.AddrDesc, vout.Addresses, vout.IsAddress, err = w.getAddressesFromVout(bchainVout)
if err != nil {
glog.V(2).Infof("getAddressesFromVout error %v, %v, output %v", err, bchainTx.Txid, bchainVout.N)
}
@@ -433,7 +433,7 @@ func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockIn
vin.N = i
vin.ValueSat = (*Amount)(&tai.ValueSat)
valInSat.Add(&valInSat, &tai.ValueSat)
vin.Addresses, vin.Searchable, err = tai.Addresses(w.chainParser)
vin.Addresses, vin.IsAddress, err = tai.Addresses(w.chainParser)
if err != nil {
glog.Errorf("tai.Addresses error %v, tx %v, input %v, tai %+v", err, txid, i, tai)
}
@@ -445,7 +445,7 @@ func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockIn
vout.N = i
vout.ValueSat = (*Amount)(&tao.ValueSat)
valOutSat.Add(&valOutSat, &tao.ValueSat)
vout.Addresses, vout.Searchable, err = tao.Addresses(w.chainParser)
vout.Addresses, vout.IsAddress, err = tao.Addresses(w.chainParser)
if err != nil {
glog.Errorf("tai.Addresses error %v, tx %v, output %v, tao %+v", err, txid, i, tao)
}
@@ -13,7 +13,6 @@ import (
"github.com/juju/errors"
)

const xpubLen = 111
const defaultAddressesGap = 20
const maxAddressesGap = 10000

@@ -271,7 +270,7 @@ func evictXpubCacheItems() {
}

func (w *Worker) getXpubData(xpub string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, gap int) (*xpubData, uint32, error) {
if w.chainType != bchain.ChainBitcoinType || len(xpub) != xpubLen {
if w.chainType != bchain.ChainBitcoinType {
return nil, 0, ErrUnsupportedXpub
}
var (
@@ -7,6 +7,7 @@ import (
"blockbook/bchain/coins/btc"
"blockbook/bchain/coins/btg"
"blockbook/bchain/coins/dash"
"blockbook/bchain/coins/dcr"
"blockbook/bchain/coins/digibyte"
"blockbook/bchain/coins/dogecoin"
"blockbook/bchain/coins/eth"
@@ -62,6 +63,8 @@ func init() {
BlockChainFactories["Bgold"] = btg.NewBGoldRPC
BlockChainFactories["Dash"] = dash.NewDashRPC
BlockChainFactories["Dash Testnet"] = dash.NewDashRPC
BlockChainFactories["Decred"] = dcr.NewDecredRPC
BlockChainFactories["Decred Testnet"] = dcr.NewDecredRPC
BlockChainFactories["GameCredits"] = gamecredits.NewGameCreditsRPC
BlockChainFactories["Koto"] = koto.NewKotoRPC
BlockChainFactories["Koto Testnet"] = koto.NewKotoRPC

0 comments on commit 08ccd06

Please sign in to comment.
You can’t perform that action at this time.