-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e70a0fe
commit 2563ac6
Showing
11 changed files
with
7,553 additions
and
191 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# Generate the protos. | ||
protoc -I/usr/local/include -I. \ | ||
-I$GOPATH/src \ | ||
--go_out=plugins=grpc:. \ | ||
btcrpc.proto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package btcrpc | ||
|
||
import ( | ||
"github.com/btcsuite/btcd/chaincfg/chainhash" | ||
"github.com/btcsuite/btcd/wire" | ||
"github.com/btcsuite/btcutil" | ||
) | ||
|
||
// NewBlockLocatorHash creates a new BlockLocator using the given block hash. | ||
func NewBlockLocatorHash(hash *chainhash.Hash) *BlockLocator { | ||
return &BlockLocator{ | ||
Locator: &BlockLocator_Hash{ | ||
Hash: hash[:], | ||
}, | ||
} | ||
} | ||
|
||
// NewBlockLocatorHeight creates a new BlockLocator using the given block height. | ||
func NewBlockLocatorHeight(height int32) *BlockLocator { | ||
return &BlockLocator{ | ||
Locator: &BlockLocator_Height{ | ||
Height: height, | ||
}, | ||
} | ||
} | ||
|
||
// NewTransactionFilter creates a new transaction filter with the given addresses | ||
// and outpoints. | ||
func NewTransactionFilter(addresses []btcutil.Address, outpoints []wire.OutPoint) *TransactionFilter { | ||
f := TransactionFilter{ | ||
Addresses: make([]string, len(addresses)), | ||
Outpoints: make([]*Transaction_Input_Outpoint, len(outpoints)), | ||
} | ||
|
||
for i, addr := range addresses { | ||
f.Addresses[i] = addr.EncodeAddress() | ||
} | ||
for i, op := range outpoints { | ||
f.Outpoints[i] = &Transaction_Input_Outpoint{ | ||
Hash: op.Hash[:], | ||
Index: op.Index, | ||
} | ||
} | ||
|
||
return &f | ||
} |
Oops, something went wrong.