diff --git a/blockdag/fullblocktests/params.go b/blockdag/fullblocktests/params.go index 9319079ae..749f2c55a 100644 --- a/blockdag/fullblocktests/params.go +++ b/blockdag/fullblocktests/params.go @@ -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) diff --git a/blockdag/mediantime.go b/blockdag/mediantime.go index 2e4f5755d..8d5c0644b 100644 --- a/blockdag/mediantime.go +++ b/blockdag/mediantime.go @@ -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. diff --git a/blockdag/mediantime_test.go b/blockdag/mediantime_test.go index f83c06c32..97dfffb97 100644 --- a/blockdag/mediantime_test.go +++ b/blockdag/mediantime_test.go @@ -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}, diff --git a/database/doc.go b/database/doc.go index 4b9717d7c..37b5dadb3 100644 --- a/database/doc.go +++ b/database/doc.go @@ -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 diff --git a/database/ffldb/blockio.go b/database/ffldb/blockio.go index 3e625375f..6782af00a 100644 --- a/database/ffldb/blockio.go +++ b/database/ffldb/blockio.go @@ -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 diff --git a/database/ffldb/db.go b/database/ffldb/db.go index 86dd6a304..73140d45b 100644 --- a/database/ffldb/db.go +++ b/database/ffldb/db.go @@ -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. diff --git a/database/interface.go b/database/interface.go index 0fec7cdb3..0d2963697 100644 --- a/database/interface.go +++ b/database/interface.go @@ -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. diff --git a/ecc/doc.go b/ecc/doc.go index 17843b408..7f107b565 100644 --- a/ecc/doc.go +++ b/ecc/doc.go @@ -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. diff --git a/ecc/pubkey_test.go b/ecc/pubkey_test.go index c01a62505..a62ee61e6 100644 --- a/ecc/pubkey_test.go +++ b/ecc/pubkey_test.go @@ -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, diff --git a/integration/rpctest/memwallet.go b/integration/rpctest/memwallet.go index 5329d0502..8bf56c683 100644 --- a/integration/rpctest/memwallet.go +++ b/integration/rpctest/memwallet.go @@ -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. diff --git a/peer/peer.go b/peer/peer.go index fea44bba7..29e554e04 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -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. diff --git a/wire/netaddress.go b/wire/netaddress.go index cea4ce9ca..1ae13684d 100644 --- a/wire/netaddress.go +++ b/wire/netaddress.go @@ -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) }