-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from ubclaunchpad/92-incoming-block-handling-l…
…ogic Incoming Block Handling Logic
- Loading branch information
Showing
6 changed files
with
146 additions
and
48 deletions.
There are no files selected for viewing
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
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,34 @@ | ||
package app | ||
|
||
import "github.com/ubclaunchpad/cumulus/blockchain" | ||
|
||
// User holds basic user information. | ||
type User struct { | ||
// Wallet holds the users wallets (currently just support 1). | ||
Wallet blockchain.Wallet | ||
// UserBlockSize is the maximum size of a block in bytes when marshaled | ||
// as specified by the user. | ||
BlockSize uint32 | ||
} | ||
|
||
var currentUser *User | ||
|
||
const defaultBlockSize = 1 << 18 | ||
|
||
func init() { | ||
// Temporary to create a new user for testing. | ||
currentUser = NewUser() | ||
} | ||
|
||
// NewUser creates a new user | ||
func NewUser() *User { | ||
return &User{ | ||
Wallet: blockchain.NewWallet(), | ||
BlockSize: defaultBlockSize, | ||
} | ||
} | ||
|
||
// GetCurrentUser returns the current user. | ||
func GetCurrentUser() *User { | ||
return currentUser | ||
} |
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
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
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
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