Skip to content

Commit

Permalink
Make kaspawallet store the utxos sorted by amount (#1924)
Browse files Browse the repository at this point in the history
* Make kaspawallet store the utxos sorted by amount, so that the bigger utxos are spent first - making it less likely a compound will be required

* Start refactor addEntryToUTXOSet

* Add GetUTXOsByBalances command to rpc

* Store list of addresses, updated with the collectAddresses methods
(replacing collectUTXOs methods)

* Fix wrong commands in GetBalanceByAddress

* Rename: refreshExistingUTXOs -> refreshUTXOs

* Display progress of IBD process in Kaspad logs (#1938)

* Report progress percentage when downloading headers in IBD.

* Extract reporting logic to a separate type.

* Report progress for IBD missing block bodies.

* Split ApplyPruningPointProof to multiple small database transactions (#1937)

* Split ApplyPruningPointProof to multiple small database transactions.

* Increase the timeout duration in TestIBDWithPruning.

* Increase the timeout duration in simple-sync.

* Explain that if ApplyPruningPointProof fails, the database must be discarded.

* Increase headers proof timeout and add more progress logs (#1939)

* Increase timeout for pruning proof and add some logs

* Show resolving virtual progress as whole percents

* Add AllowConnectionToDifferentVersions flag to kaspactl (#1940)

* Remove duplicate median time calculation on tx validation (#1943)

Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>

* Drop support for p2p v3 (#1942)

* Drop support for p2p v3

* Remove redundant aliases

* Remove redundant condition

* In profile dump file - use a time format supporting all file systems (#1945)

* Use a time format without ":" to support all file systems

* go fmt

* Bump version to v0.11.12 (#1941)

Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>

Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
  • Loading branch information
4 people committed Feb 18, 2022
1 parent 4a560f2 commit 16336b0
Show file tree
Hide file tree
Showing 66 changed files with 1,079 additions and 2,725 deletions.
4 changes: 4 additions & 0 deletions app/appmessage/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type RPCError struct {
Message string
}

func (err RPCError) Error() string {
return err.Message
}

// RPCErrorf formats according to a format specifier and returns the string
// as an RPCError.
func RPCErrorf(format string, args ...interface{}) *RPCError {
Expand Down
4 changes: 4 additions & 0 deletions app/appmessage/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ const (
CmdNotifyVirtualDaaScoreChangedRequestMessage
CmdNotifyVirtualDaaScoreChangedResponseMessage
CmdVirtualDaaScoreChangedNotificationMessage
CmdGetBalancesByAddressesRequestMessage
CmdGetBalancesByAddressesResponseMessage
)

// ProtocolMessageCommandToString maps all MessageCommands to their string representation
Expand Down Expand Up @@ -274,6 +276,8 @@ var RPCMessageCommandToString = map[MessageCommand]string{
CmdNotifyVirtualDaaScoreChangedRequestMessage: "NotifyVirtualDaaScoreChangedRequest",
CmdNotifyVirtualDaaScoreChangedResponseMessage: "NotifyVirtualDaaScoreChangedResponse",
CmdVirtualDaaScoreChangedNotificationMessage: "VirtualDaaScoreChangedNotification",
CmdGetBalancesByAddressesRequestMessage: "GetBalancesByAddressesRequest",
CmdGetBalancesByAddressesResponseMessage: "GetBalancesByAddressesResponse",
}

// Message is an interface that describes a kaspa message. A type that
Expand Down
47 changes: 47 additions & 0 deletions app/appmessage/rpc_get_balances_by_addresses.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package appmessage

// GetBalancesByAddressesRequestMessage is an appmessage corresponding to
// its respective RPC message
type GetBalancesByAddressesRequestMessage struct {
baseMessage
Addresses []string
}

// Command returns the protocol command string for the message
func (msg *GetBalancesByAddressesRequestMessage) Command() MessageCommand {
return CmdGetBalancesByAddressesRequestMessage
}

// NewGetBalancesByAddressesRequest returns a instance of the message
func NewGetBalancesByAddressesRequest(addresses []string) *GetBalancesByAddressesRequestMessage {
return &GetBalancesByAddressesRequestMessage{
Addresses: addresses,
}
}

// BalancesByAddressesEntry represents the balance of some address
type BalancesByAddressesEntry struct {
Address string
Balance uint64
}

// GetBalancesByAddressesResponseMessage is an appmessage corresponding to
// its respective RPC message
type GetBalancesByAddressesResponseMessage struct {
baseMessage
Entries []*BalancesByAddressesEntry

Error *RPCError
}

// Command returns the protocol command string for the message
func (msg *GetBalancesByAddressesResponseMessage) Command() MessageCommand {
return CmdGetBalancesByAddressesResponseMessage
}

// NewGetBalancesByAddressesResponse returns an instance of the message
func NewGetBalancesByAddressesResponse(entries []*BalancesByAddressesEntry) *GetBalancesByAddressesResponseMessage {
return &GetBalancesByAddressesResponseMessage{
Entries: entries,
}
}
2 changes: 1 addition & 1 deletion app/protocol/flows/handshake/receiveversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

// minAcceptableProtocolVersion is the lowest protocol version that a
// connected peer may support.
minAcceptableProtocolVersion = uint32(3)
minAcceptableProtocolVersion = uint32(4)

maxAcceptableProtocolVersion = uint32(4)
)
Expand Down
33 changes: 0 additions & 33 deletions app/protocol/flows/v3/blockrelay/block_locator.go

This file was deleted.

86 changes: 0 additions & 86 deletions app/protocol/flows/v3/blockrelay/handle_ibd_block_locator.go

This file was deleted.

54 changes: 0 additions & 54 deletions app/protocol/flows/v3/blockrelay/handle_ibd_block_requests.go

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 16336b0

Please sign in to comment.