hypercore 11.27.16 → 11.27.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -962,6 +962,7 @@ class Hypercore extends EventEmitter {
962
962
 
963
963
  async truncate(newLength = 0, opts = {}) {
964
964
  if (this.opened === false) await this.opening
965
+ if (this.closing) throw SESSION_CLOSED('Cannot append to a closed session', this.discoveryKey)
965
966
 
966
967
  const {
967
968
  fork = this.state.fork + 1,
@@ -983,6 +984,7 @@ class Hypercore extends EventEmitter {
983
984
 
984
985
  async append(blocks, opts = {}) {
985
986
  if (this.opened === false) await this.opening
987
+ if (this.closing) throw SESSION_CLOSED('Cannot append to a closed session', this.discoveryKey)
986
988
 
987
989
  const isDefault = this.state === this.core.state
988
990
  const defaultKeyPair = this.state.name === null ? this.keyPair : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.27.16",
3
+ "version": "11.27.17",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {