[NOD-510] Fix comments so that they don't mention bitcoin. (#551)

This commit is contained in:
stasatdaglabs 2019-12-18 13:46:32 +02:00 committed by Ori Newman
parent 818f8c93eb
commit 0d1f447cb7
12 changed files with 17 additions and 42 deletions

View File

@ -59,7 +59,7 @@ var (
// the overhead of creating it multiple times.
bigOne = big.NewInt(1)
// regressionPowLimit is the highest proof of work value a Bitcoin block
// regressionPowLimit is the highest proof of work value a kaspa block
// can have for the regression test network. It is the value 2^255 - 1.
regressionPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)

View File

@ -71,9 +71,6 @@ func (s int64Sorter) Less(i, j int) bool {
}
// medianTime provides an implementation of the MedianTimeSource interface.
// It is limited to maxMedianTimeEntries includes the same buggy behavior as
// the time offset mechanism in Bitcoin Core. This is necessary because it is
// used in the consensus code.
type medianTime struct {
mtx sync.Mutex
knownIDs map[string]struct{}
@ -137,15 +134,6 @@ func (m *medianTime) AddTimeSample(sourceID string, timeVal time.Time) {
log.Debugf("Added time sample of %s (total: %d)", offsetDuration,
numOffsets)
// NOTE: The following code intentionally has a bug to mirror the
// buggy behavior in Bitcoin Core since the median time is used in the
// consensus rules.
//
// In particular, the offset is only updated when the number of entries
// is odd, but the max number of entries is 200, an even number. Thus,
// the offset will never be updated again once the max number of entries
// is reached.
// The median offset is only updated when there are enough offsets and
// the number of offsets is odd so the middle value is the true median.
// Thus, there is nothing to do when those conditions are not met.

View File

@ -34,9 +34,7 @@ func TestMedianTime(t *testing.T) {
{in: []int64{-5, -4, -3, -2, -1}, wantOffset: -3, useDupID: true},
// The offset stops being updated once the max number of entries
// has been reached. This is actually a bug from Bitcoin Core,
// but since the time is ultimately used as a part of the
// consensus rules, it must be mirrored.
// has been reached.
{in: []int64{-67, 67, -50, 24, 63, 17, 58, -14, 5, -32, -52}, wantOffset: 17},
{in: []int64{-67, 67, -50, 24, 63, 17, 58, -14, 5, -32, -52, 45}, wantOffset: 17},
{in: []int64{-67, 67, -50, 24, 63, 17, 58, -14, 5, -32, -52, 45, 4}, wantOffset: 17},

View File

@ -17,7 +17,7 @@ storage, and strict checksums in key areas to ensure data integrity.
A quick overview of the features database provides are as follows:
- Key/value metadata store
- Bitcoin block storage
- Kaspa block storage
- Efficient retrieval of block headers and regions (transactions, scripts, etc)
- Read-only and read-write transactions with both manual and managed modes
- Nested buckets

View File

@ -215,15 +215,8 @@ func serializeBlockLoc(loc blockLocation) []byte {
// blockFilePath return the file path for the provided block file number.
func blockFilePath(dbPath string, fileNum uint32) string {
// The Bitcoin protocol encodes block height as int32, so max number of
// blocks is 2^31. Max block size per the protocol is 32MiB per block.
// So the theoretical max at the time this comment was written is 64PiB
// (pebibytes). With files @ 512MiB each, this would require a maximum
// of 134,217,728 files. Thus, choose 9 digits of precision for the
// filenames. An additional benefit is 9 digits provides 10^9 files @
// 512MiB each for a total of ~476.84PiB (roughly 7.4 times the current
// theoretical max), so there is room for the max block size to grow in
// the future.
// Choose 9 digits of precision for the filenames. 9 digits provide
// 10^9 files @ 512MiB each a total of ~476.84PiB.
fileName := fmt.Sprintf("%09d.fdb", fileNum)
return filepath.Join(dbPath, fileName)
@ -466,7 +459,7 @@ func (s *blockStore) writeBlock(rawBlock []byte) (blockLocation, error) {
wc.curFile.file = file
}
// Bitcoin network.
// Kaspa network.
origOffset := wc.curOffset
hasher := crc32.New(castagnoli)
var scratch [4]byte

View File

@ -1458,7 +1458,7 @@ func (tx *transaction) fetchPendingRegion(region *database.BlockRegion) ([]byte,
// FetchBlockRegion returns the raw serialized bytes for the given block region.
//
// For example, it is possible to directly extract Bitcoin transactions and/or
// For example, it is possible to directly extract Kaspa transactions and/or
// scripts from a block with this function. Depending on the backend
// implementation, this can provide significant savings by avoiding the need to
// load entire blocks.
@ -1531,7 +1531,7 @@ func (tx *transaction) FetchBlockRegion(region *database.BlockRegion) ([]byte, e
// FetchBlockRegions returns the raw serialized bytes for the given block
// regions.
//
// For example, it is possible to directly extract Bitcoin transactions and/or
// For example, it is possible to directly extract Kaspa transactions and/or
// scripts from various blocks with this function. Depending on the backend
// implementation, this can provide significant savings by avoiding the need to
// load entire blocks.

View File

@ -337,7 +337,7 @@ type Tx interface {
// FetchBlockRegion returns the raw serialized bytes for the given
// block region.
//
// For example, it is possible to directly extract Bitcoin transactions
// For example, it is possible to directly extract Kaspa transactions
// and/or scripts from a block with this function. Depending on the
// backend implementation, this can provide significant savings by
// avoiding the need to load entire blocks.
@ -364,7 +364,7 @@ type Tx interface {
// FetchBlockRegions returns the raw serialized bytes for the given
// block regions.
//
// For example, it is possible to directly extract Bitcoin transactions
// For example, it is possible to directly extract Kaspa transactions
// and/or scripts from various blocks with this function. Depending on
// the backend implementation, this can provide significant savings by
// avoiding the need to load entire blocks.
@ -408,7 +408,7 @@ type Tx interface {
Rollback() error
}
// DB provides a generic interface that is used to store bitcoin blocks and
// DB provides a generic interface that is used to store kaspa blocks and
// related metadata. This interface is intended to be agnostic to the actual
// mechanism used for backend data storage. The RegisterDriver function can be
// used to add a new backend data storage method.

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
/*
Package ecc implements support for the elliptic curves needed for bitcoin.
Package ecc implements support for the elliptic curves needed for kaspa.
Bitcoin uses elliptic curve cryptography using koblitz curves
Kaspa uses elliptic curve cryptography using koblitz curves
(specifically secp256k1) for cryptographic functions. See
http://www.secg.org/collateral/sec2_final.pdf for details on the
standard.

View File

@ -19,8 +19,6 @@ type pubKeyTest struct {
}
var pubKeyTests = []pubKeyTest{
// pubkey from bitcoin blockchain tx
// 0437cd7f8525ceed2324359c2d0ba26006d92d85
{
name: "uncompressed ok",
key: []byte{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,

View File

@ -137,7 +137,7 @@ func newMemWallet(net *dagconfig.Params, harnessID uint32) (*memWallet, error) {
}
// Track the coinbase generation address to ensure we properly track
// newly generated bitcoin we can spend.
// newly generated kaspa we can spend.
addrs := make(map[uint32]util.Address)
addrs[0] = coinbaseAddr
@ -333,7 +333,7 @@ func (m *memWallet) NewAddress() (util.Address, error) {
return m.newAddress()
}
// fundTx attempts to fund a transaction sending amt bitcoin. The coins are
// fundTx attempts to fund a transaction sending amt kaspa. The coins are
// selected such that the final amount spent pays enough fees as dictated by
// the passed fee rate. The passed fee rate should be expressed in
// sompis-per-byte.

View File

@ -117,7 +117,7 @@ type MessageListeners struct {
// OnBlock is invoked when a peer receives a block kaspa message.
OnBlock func(p *Peer, msg *wire.MsgBlock, buf []byte)
// OnInv is invoked when a peer receives an inv bitcoin message.
// OnInv is invoked when a peer receives an inv kaspa message.
OnInv func(p *Peer, msg *wire.MsgInv)
// OnGetBlockLocator is invoked when a peer receives a getlocator kaspa message.
@ -137,7 +137,7 @@ type MessageListeners struct {
// message.
OnGetBlockInvs func(p *Peer, msg *wire.MsgGetBlockInvs)
// OnFeeFilter is invoked when a peer receives a feefilter bitcoin message.
// OnFeeFilter is invoked when a peer receives a feefilter kaspa message.
OnFeeFilter func(p *Peer, msg *wire.MsgFeeFilter)
// OnFilterAdd is invoked when a peer receives a filteradd kaspa message.

View File

@ -93,7 +93,6 @@ func readNetAddress(r io.Reader, pver uint32, na *NetAddress, ts bool) error {
if err != nil {
return err
}
// Sigh. Bitcoin protocol mixes little and big endian.
port, err := binaryserializer.Uint16(r, bigEndian)
if err != nil {
return err
@ -129,6 +128,5 @@ func writeNetAddress(w io.Writer, pver uint32, na *NetAddress, ts bool) error {
return err
}
// Sigh. Bitcoin protocol mixes little and big endian.
return binary.Write(w, bigEndian, na.Port)
}